MacOS – Environment Variables on Mavericks

macosterminal

I am trying to set an environment variable that will be accessible from both a GUI application (Pycharm) as well as from the Terminal. This variable is called PYTHONPATH.

I have tried

Can anyone give me a step by step guide of how to do this correctly on Mavericks?

Best Answer

Check your current PYTHONPATH setting by opening /Applications/Utilities/Terminal.app and typing the following command and hit the return key:

  echo $PYTHONPATH

Try this alternate syntax in Terminal.app to see if it sets your PYTHONPATH correctly. Recheck the result with the above command again. If so, put the line in your ~/.bash_profile (although a file in /etc/paths.d/ with just the PATH, no commands, ought to set this system-wide).

  export PYTHONPATH=$PYTHONPATH\ : $USER/Documents/CrowdSurfer ; export PYTHONPATH