PYTHONPATH in OS X
<p>I set PYTHONPATH variable on my Apple laptop a while ago.
I have checked /private/etc/profile config file. It is not there. Where else I could find it?</p>

<p>What other config file could be used to set the PYTHONPATH variable on OS X?</p>

<p>There are several config files that can be used to set <strong>PYTHONPATH</strong> in OS X:</p>

<p>The first is <strong>profile</strong> file which is located in hidden <em>/private/etc/</em> folder:</p>

<pre><code>/private/etc/profile
</code></pre>

<p>You can use the following syntax to set the variable there:</p>

<pre><code>export MY_CUSTOM_ENV_VARIABLE="/Applications/MyApp/bin"
</code></pre>

<p>Other config files are <code>.cshrc</code>, <code>.bashrc</code> and <code>. bash_profile</code> which (thanks <a href="http://stackoverflow.com/users/3991125/albert">albert</a> for your info) are located in user's home directory and based on your OS X might or might not be there:</p>

<pre><code>/Users/username/.cshrc
/Users/username/.bashrc
/Users/username/.bash_profile
</code></pre>

<p>To set the environment variable in <code>.cshrc</code> file use the syntax below:</p>

<pre><code>setenv MY_CUSTOM_ENV_VARIABLE /Applications/MyApp/bin
</code></pre>

<p>To set the environment variable using <code>.bash_profile</code> file use this syntax:</p>

<pre><code>export MY_CUSTOM_ENV_VARIABLE=/Applications/MyApp/bin:$MY_CUSTOM_ENV_VARIABLE
</code></pre>

<p>In my case <strong>PYTHONPATH</strong> variable was set in <code>.bash_profile</code> file. And it was set with the following syntax:</p>

<pre><code>export PYTHONPATH=/Users/myModules:$PYTHONPATH
</code></pre>

python