From: Anupam Sengupta Date: 2007-06-27T11:55:09+09:00 Subject: Re: OS X reads builtin version of ruby >>>>> "Richard" == Richard Lawrence writes: Richard> The line Python installs in ~/.bash_profile seemed to be overriding Richard> the PATH setting in ~/.bash_login that the HiveLogic article Richard> advised. Richard> My solution was to move the Python line from .bash_profile, and Richard> include it in .bash_login. I then deleted .bash_profile (or Richard> rather, moved it to .bash_profile.bad.) My .bash_login now looks Richard> like this: You should move the contents of '.bash_login' to '.bashrc' For an interactive login shell (like the one you see in OS X Terminal), when bash starts up, it looks for the following files (in the order listed) and reads only the FIRST file it finds (in your case, .bash_login, since you deleted .bash_profile): 1. ~/.bash_profile 2. ~/.bash_login 3. ~/.profile (this is mostly for Bourne Shell compatibility) However, a non-login shell will ONLY read ~/.bashrc You can check this behavior by trying out the experiment listed at the bottom of this post. In order to ensure a consistent behavior (e.g. for the shells that you open via Terminal.app and also for the ones that other applications such as BBEdit or TextMate open for you), try the following: 1. Move the content of .bash_login to .bashrc 2. Delete .bash_login (after moving its contents) 3. Edit a new .bash_profile to have the following content: # Check for bash rc and source it. All changes to to that file. [[ -f ~/.bashrc ]] && . ~/.bashrc This line basically ensures that contents of .bashrc are also loaded when you have a normal login shell. 4. Quit Terminal.app and relaunch. Your PATH related changes should be effective. Richard> which seems to work like a charm. I'm not all that knowledgeable Richard> about this stuff, though, so you may better off editing .bashrc, as Richard> Herbie advised. The bash manual page at: http://www.gnu.org/software/bash/manual/bashref.html#SEC65 has all the gory details which will help you here. Another good and succinct article explaining the concept is: http://jmatrix.net/dao/case/case.jsp?case=7F000001-1C208B0-10C91F4FD67-107 Hope this helps. =================================== EXPERIMENT ================================= As an experiment, try this (first backup your existing files by renaming them to something like .bash_login.bkp, .bash_profile.bkp and .bashrc.bkp): Step 1: Create a single line .bash_profile with the content: echo "bash_profile was read" Step 2: Create a single line .bashrc with the content: echo "bashrc was read" Step 3: Ensure that you have renamed .bash_login and no such file exists in your home directory. Step 4: Quit the Terminal.app and restart it again (or open a new Terminal Window). You should see this in the Terminal window: bash_profile was read This indicates that only bash_profile is read on an interactive login terminal. Step 5: Now enter the following command to start another interactive (BUT non-login bash shell: $ bash You should see the following: bashrc was read This indicates that this time around, only .bashrc was read by the shell, since it determined that it is *not* a login shell. Step 6: Revert back all files from the .bkp versions you had created earlier. =============================================================================== -- Anupam