Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 5224

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>teaching your shell how to find M2</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_moving_spor_spcopying_spthe_sp__Macaulay2_spfiles.html">next</a> | <a href="_teaching_sp__M2_sphow_spto_spfind_spits_spshared_splibraries.html">previous</a> | <a href="_moving_spor_spcopying_spthe_sp__Macaulay2_spfiles.html">forward</a> | <a href="_teaching_sp__M2_sphow_spto_spfind_spits_spshared_splibraries.html">backward</a> | <a href="_getting_spstarted.html">up</a> | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_getting_spstarted.html" title="">getting started</a> > <a href="_teaching_spyour_spshell_sphow_spto_spfind_sp__M2.html" title="">teaching your shell how to find M2</a></div>
<hr/>
<div><h1>teaching your shell how to find M2</h1>
<div>Perhaps you have typed M2 into a shell window and gotten something like the following response:<pre>     % M2
     bash: M2: command not found</pre>
If so, then you have to teach your shell how to find M2.<p/>
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.<p/>
If you teach your shell how to find M2, then emacs may be able to find M2, also.<p/>
The simplest way to teach your shell how to find M2 is to let M2 do it for you.  Assume that you have found M2, and it is located at the path <tt>/foo/bar/bin/M2</tt>.  Run the command /foo/bar/bin/M2, and then, in response to Macaulay2's input prompt, enter <tt>setup()</tt>.  If that works, the next time you log in or start a new shell, the shell should know how to find M2 (see <a href="_setup.html" title="">setup</a>).  If that doesn't work, read onward.<p/>
Your goal is to add the directory containing M2 to the value of the PATH environment variable.  For this, you must know where the Macaulay2 files are: see <a href="_finding_spthe_sp__Macaulay2_spfiles.html" title="">finding the Macaulay2 files</a>.  Your system administrator may have installed the Macaulay2 files under /usr, in which case you will see M2 in /usr/bin, and you can ignore the rest of this section.  The files may also be installed under /usr/local, in which case you will see M2 in /usr/local/bin, and you can ignore the rest of this section, provided you have /usr/local/bin on your PATH.  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.<p/>
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.<h2>Bourne shells</h2>
A Bourne shell reads commands from the file .profile in your home directory when you log in, except perhaps under Mac OS X.  The bash shell will also read commands from .bashrc each subsequent time it starts up, after the initial log in.  To add a directory called, say <tt>/foo/bar/bin</tt>, to your PATH, put this command in your file .profile:<pre>     export PATH=/foo/bar/bin:$PATH</pre>
It will be acted upon the next time you log in, or the following shell command will run those commands in your current shell.<pre>     source $HOME/.profile</pre>
<h2>C shells</h2>
A C shell reads commands from the file .login in your home directory when you log in, except perhaps under Mac OS X.  The shell will also read commands from .cshrc or perhaps .tcshrc.  Check the man page of your shell.<p/>
To add a directory called, say <tt>/foo/bar/bin</tt>, to your PATH, put this command in your file .login:<pre>     setenv PATH /foo/bar/bin:$PATH</pre>
It will be acted upon the next time you log in, or the following shell command will run those commands in your current shell.<pre>     source $HOME/.profile</pre>
<h2>making a link to M2</h2>
Another way to proceed that sometimes works is this.  Look at the output from the shell command:<pre>          printenv PATH</pre>
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:<pre>      mkdir ~/bin</pre>
Ignore the error message if the directory already exists.  Then make the symbolic link with this command:<pre>          ln -s /Applications/Macaulay2/bin/M2 ~/bin/M2</pre>
After that your shell will be able to find M2, and M2 will be able to find its files (because it knows about symbolic links).  (Don't use a hard link.)<h2>what else to try</h2>
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 <a href="_teaching_spemacs_sphow_spto_spfind_sp__M2.html" title="">teaching emacs how to find M2</a>.</div>
</div>
</body>
</html>