next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > how Macaulay2 finds its files

how Macaulay2 finds its files

When you run Macaulay2, it has to find and load a sequence of startup files containing code written in the Macaulay2 language, or it has to find a data file containing a memory dump from a previous session. Here is the way it does that.

Its first task is to discover the path to the binary file M2 that is currently running. On some systems, that information is available from the /proc file system. Otherwise, it examines the command name you used to run the program, which is provided to it as the argument in position number 0 on the command line. If it's not an absolute path, it searches along the path of directories mentioned in the environment variable PATH until it finds a file with the same name. If the result is a symbolic link, the link is followed. The final result is assumed to be in a directory named "bin/", and the startup files are located relative to that. The path to the top level directory is stored in the variable prefixDirectory, which you can examine to see whether it all worked out. For detailed information about the relative location of Macaulay2 files, see Layout.

A possible data memory dump file may be located in the directory lib/Macaulay2/Core/cache/ and loaded with loaddata. If the file is present and and loading it works, then startup will be quicker. If it's absent then the necessary setup files will be loaded instead; if problems with it are encountered, it is always safe to delete it. The name of the file data dump file is of the form "Macaulay2-*-data", where "*" is replaced by the value of the environment variable name M2ARCH if present, or else is a value computed at compile time and stored in the hash table called version and accessible as version#"architecture".

Menu