# 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.

One way, under Unix, is to use the following shell command.

     type M2
The response will be of the following form.
     M2 is /foo/bar/bin/M2
The Macaulay2 files come in a directory tree that mimics the directory tree found on unix systems in the directory /usr. In particular, its top-level directory has subdirectories called bin, info, lib, and share, so now we know, from the output above, that the Macaulay 2 files have been installed with a prefix /foo/bar as the name of its root directory. It will follow, for example, that the M2 emacs init file is located at /foo/bar/share/emacs/site-lisp/Macaulay2/M2-init.el.

Another way to locate the files of Macaulay2 is to ask M2, assuming you can run it. Start M2 and type the following expression.

     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/ 
If you are running M2 and emacs under cygwin on a Windows computer, then that can prevent special difficulties: see finding your files under cygwin.