Perhaps you have typed M2 into a shell window and gotten something like the following response:
|
If so, then you have to teach your shell how to find M2. Once you do this, then Emacs may also be able to find M2.
Your shell will look for M2 in the directories listed in the value of the PATH environment variable. You will want to arrange for that value to get set when you log in or when you start your shell. The former is preferable, because environment variables are inherited by new processes only from their parents, and your login shell is an ancestor of all of your processes.
First, you must know where the Macaulay2 files are: see finding the Macaulay2 files. Your goal is to add the directory containing M2 to the value of the PATH environment variable.
Your system administrator may have installed the Macaulay2 files under /usr, in which case you will see M2 in /usr/bin. The files may also be installed under /usr/local, in which case you will see M2 in /usr/local/bin. Or the files may be installed somewhere else, such as in /Applications/Macaulay2, in which case you will see M2 in /Applications/Macaulay2/bin, and you will want to add that directory to your path now.
The simplest way to teach your shell how to find M2 is to let M2 do it for you. Say you know that your M2 executable is located at /foo/bar/bin/M2. Run the command /foo/bar/bin/M2 and enter setup(). If you see an error about shared libraries, see teaching M2 how to find its shared libraries. If that works, the next time you log in or start a new shell, the shell should know how to find M2. If that doesn't work, read onward.
The method for setting environment variables depends on which shell you are using. Typical shells in use include ash, bash, csh, tcsh, ksh, sh, and zsh. The command languages understood by these shells differ, but they fall into two main classes: the Bourne shells sh, bash, ash, zsh, and ksh; and the C shells csh and tcsh.
A Bourne shell reads commands from the file .profile in your home directory when you log in. The bash shell will also read commands from .bashrc each subsequent time it starts up, after the initial log in. To add a directory to your PATH, put this command in .profile:
|
A C shell reads commands from the file .login in your home directory when you log in. The shell will also read commands from .cshrc or perhaps .tcshrc. Check the manual page of your shell.
To add a directory called to your PATH, put this command in .login:
|
Another way to proceed that sometimes works is this. Look at the output from the shell command:
|
and see whether one of your own directories is already on the path. If so, say it's ~/bin, then you can make a symbolic link from M2 to that directory, and it will appear on your path. First ensure the directory has been made with this command:
|
Ignore the error message if the directory already exists. Then make the symbolic link with this command:
|
After that your shell will be able to find M2, and M2 will be able to find its files.
If you fail to teach your shell how to find M2, then all is not lost. We prefer to run M2 within Emacs, and it is enough to teach Emacs how find M2. See teaching Emacs how to find M2.
The source of this document is in Macaulay2Doc/ov_getting_started.m2:320:0.