I've read the documentation and tutorials on using Mathematica and the kernel from the command line, and all of these materials suggest that I ought to be able to simply type either

$ mathematica


$ math

in Terminal, assuming these these commands have been installed in (variously) /usr/local/bin or /usr/bin. But I get the usual "command not found" error message that results when this is not the case, even though these directories are in my PATH.

Where does Mathematica (9.0) really install mathematica and math on OSX Lion?


2 Answers 2


On OS X, it's called MathKernel and not mathematica or math. This file is located in the directory given by:

FileNameJoin[{$InstallationDirectory, "Contents", "MacOS"}]

You can see a partial list of files in that directory:

FileNames["Math*", FileNameJoin[{$InstallationDirectory, "Contents", "MacOS"}]]
(* {
    "/Applications/Mathematica 9.app/Contents/MacOS/Mathematica", 
    "/Applications/Mathematica 9.app/Contents/MacOS/MathematicaScript", 
    "/Applications/Mathematica 9.app/Contents/MacOS/MathematicaServer", 
    "/Applications/Mathematica 9.app/Contents/MacOS/MathKernel"
} *)

You'll have to call it from your terminal with the full path or add that folder to your path before calling it as MathKernel.

  • $\begingroup$ And, of course, once you know the name, you can use locate to find where it is. Then put it on your path. $\endgroup$
    – murray
    Commented Dec 12, 2012 at 16:38
  • $\begingroup$ Or symlink them into your bin directory $\endgroup$
    – Szabolcs
    Commented Dec 12, 2012 at 17:05
  • 2
    $\begingroup$ Or create an alias or a wrapper, see my web page. $\endgroup$
    – Jens
    Commented Dec 12, 2012 at 17:08
  • $\begingroup$ @Jens: Cool excellent advice! $\endgroup$
    – orome
    Commented Dec 12, 2012 at 18:10

You can simply create an alias in your bash profile. Assuming you are working in Terminal, open the profile in a suitable text editor

nano ~/.bash_profile

and add the following line:

alias mathematica='/Applications/Mathematica.app/Contents/MacOS/MathKernel'

Save the modified profile file, quit the editor, and reload your bash profile

source ~/.bash_profile

and now you can call mathematica directly.

PS: You can create alias of an alias (e.g., alias math='mathematica').

  • 1
    $\begingroup$ Creating alias of Mathematica is also helpful on certain Linux distributions. +1 $\endgroup$
    – Leo Fang
    Commented Aug 7, 2013 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.