Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Mathematica 8 installed on my OS X Mountain Lion laptop. I want to set my PATH so that I can run either MathematicaKernel or Mathematica from the command line. To this end I have configured my .bash_profile so that it reads:

$MAC_Mma="/Applications/Mathematica\ Home\"
export PATH=/opt/local/bin:/Users/comerduncan/newipython/ipython/build/scripts-2.7/:/Users/comerduncan:/Users/comerduncan/Sandbox/sympy/sympy/:$MAC_Mma:$PATH

When the .bash_profile file is read when the terminal is created and I try to execute MathematicaKernel, no such executable is found. However, if I create an alias:

alias math='/Applications/Mathematica\ Home\'

in the .bash_profile file, then when I run math the kernel starts up as usual.

Alas, this alias way does not fit my need in another case where a bash script is run which needs to find the MathematicaKernel in the path. SO, my question is why does the alias way work and my way via the PATH not work?

share|improve this question

migrated from Aug 10 '12 at 19:44

This question came from our site for system and network administrators.

Stop using backslashes in your variables, and start quoting them.

foo="/path/that/has some spaces"
share|improve this answer
Thanks for your help. I must admit that I am usually a csh person but have recently finally tried to switch to bash. So my inexperience with bash is showing! Your suggestion works fine. In fact, I have subsequently repaired a non working bash script which needs MathKernel to do a bunch of processing. So now I can do what I need. Comer – user27210 Aug 10 '12 at 21:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.