1

I am still relatively new to the workings of the Mac OS but have extensive knowledge of Linux. I updated my php on Mavericks using the php_osx and the instructions stated to use export PATH=/usr/local/php5/bin:$PATH to have the new php version used.

Through my attempt to update php I found references to the following files:

  • .bash_profile - I can not find this file.
  • .bashrc
  • paths
  • path_helper

Can someone please provide a simple understanding of how $PATH is created in Mavericks and help me understand where the export command put the edition to the path and how would I remove it if I want too?

4

On OS X you'll have following :

The base PATH used is located in /etc/paths. It is used to set $PATH.

By default, the file contains :

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

It will also load the paths located in /etc/path.d/.

When opening the terminal I will load :

  1. ~/.bash_profile
  2. ~/.bash_login, (if .bash_profile doesn't exist)
  3. ~/.profile (if .bash_login doesn't exist).

These files can load some other files, for example .bashrc.

If you want to expand your path you can do it in one of the files by adding your export command you gave in your question.

  • Right! I updated that part. – Matthieu Riegler Feb 14 '14 at 16:46
  • Matthieu thanks for the response. However I have never created a .bash_profile or .bash_login or .profile and can not find them. There is a /etc/bashrc file and the only file in the path.d directory is 40-XQuartz. The /etc/profile file seems to point to path_helper. I can not seem to find where the export command I ran went to and how I would remove it if I wanted too. Any help would be appreciated. – user1088014 Feb 15 '14 at 14:35
  • export has only a effect on the current bash session. – Matthieu Riegler Feb 15 '14 at 14:48
  • Ok. Getting closer to an understanding. What does the export in my example do then that allows the php to always use the new version that is in a different directory then the preloaded version. – user1088014 Feb 15 '14 at 14:54
  • If you want to have your path changed in every session, you have to put it in a file loaded with every new bash session. For example in one of the 3 files given above. If you haven't one, you can create it. – Matthieu Riegler Feb 15 '14 at 15:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .