title: Change PATH Environment Variable in MAMP
body: <p>I need to update my <strong>PATH</strong> variable within a <strong><a href="https://www.mamp.info/en/" rel="nofollow noreferrer">MAMP v3.4</a></strong> server.</p>
  
  <p>As you can see, the <strong>PATH</strong> environment variable that Apache is using does not match the <strong>PATH</strong> that I use when I open terminal.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
    passthru('env');
    die();
  </code></pre>
  
  <p>The script above prints out:</p>
  
  <pre class="lang-none prettyprint-override"><code>...
  PATH=/usr/bin:/bin:/usr/sbin:/sbin
  ...
  </code></pre>
  
  <p>Meanwhile, my <strong>PATH</strong> when I run my terminal is:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ env
    ...
    PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  </code></pre>
  
  <p>I have tried the solutions offered <a href="https://stackoverflow.com/questions/32110634/how-to-set-environment-variable-in-mamp">here</a> and <a href="https://stackoverflow.com/questions/11256008/setting-environment-variables-in-mamp">here</a>, but none have worked.</p>
  
  <p>Setting an environment variable in <code>/Applications/MAMP/conf/apache/httpd.conf</code> seemed promising, but it doesn't work when setting <strong>PATH</strong>.</p>
  
  <pre class="lang-none prettyprint-override"><code># Near the top of my httpd.conf file...
  SetEnv MY_TEST_DETAIL foo
  SetEnv PATH /usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  </code></pre>
  
  <p>I restart my MAMP server, and looked at <code>phpinfo()</code></p>
  
  <p><a href="https://i.stack.imgur.com/A1QqE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A1QqE.png" alt="Apache Environment Variables"></a></p>
  
  <p>As you can see, it added the <strong>MY_TEST_DETAIL</strong> environment variable, but it did not change <strong>PATH</strong>.</p>