Macaulay2 » Documentation
Packages » Macaulay2Doc » setting up Macaulay2 » finding the Macaulay2 files
next | previous | forward | backward | up | index | toc

finding the Macaulay2 files

Often you will know where the Macaulay2 files are, because you have installed them yourself. But it can happen that Macaulay2 was installed by your system administrator so you can run M2, but you don't know where its files are. In that case, there are a couple of ways to locate the files.

The Macaulay2 files come in a directory tree that mimics the /usr directory on Unix-based systems. In particular, its top-level prefix directory has subdirectories called bin, info, lib, and share (see GNU Coding Standards)

One way to find the top-level prefix directory is to use the shell command which M2 or type M2. The response will be of the form /foo/bar/bin/M2. From this output, we learn that the Macaulay2 files have been installed in the top-level prefix directory /foo/bar. It will follow, for example, that the M2 Emacs init file is located at /foo/bar/share/emacs/site-lisp/Macaulay2/M2-init.el.

In some systems, you can instead find the prefix directory by running locate M2-binary, which lists all files of that name found on the system. Note that this will also find older versions of Macaulay2 if you have several versions installed.

Another way to locate the files of Macaulay2 is to ask M2, assuming you can run it. Start M2 and type prefixDirectory. The response will be of the following form, and will also tell you the prefix for the paths to the Macaulay2 files.

i1 : prefixDirectory

o1 = /foo/bar/

See also


The source of this document is in Macaulay2Doc/ov_getting_started.m2:320:0.