Macaulay2 » Documentation
Packages » Macaulay2Doc > The Macaulay2 language > system facilities > initialization file
next | previous | forward | backward | up | index | toc

initialization file

The file init.m2 is loaded automatically when the program is started, if it exists.

On most systems the file is sought in the directory $HOME/.Macaulay2/, where $HOME is replaced by the path to the user's home directory.

Under Mac OS X, the file is sought instead in the directory $HOME/Library/Application Support/Macaulay2/.

If the user wants a file called, say, start.m2 in the current directory to be loaded automatically when the program is started, then the following line of code can be placed in the file init.m2.

if fileExists "start.m2" then load(currentDirectory()|"start.m2")

Warning: former versions of the program would also load a file named init.m2 found in the current directory.