Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So far I had /Applications/play-1.2.5/ added to my $PATH variable. Now I'm working with 2.2.1, which I installed in /Applications/play-2.2.1 and changed in ~/.bash_profile (which is getting sourced at startup). However, when printing $PATH, 1.2.5 is somehow still around:

mbp:~ user$ echo $PATH
/usr/local/share/npm/bin:/Applications/play-2.2.1:/usr/local/heroku/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/play-1.2.5:/Applications/XAMPP/xamppfiles/bin/:/opt/X11/bin

As far as I now, I only entered $PATH variables in .bash_profile, which looks like this:

mbp:~ user$ cat .bash_profile 
source ~/.git-completion.bash

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"


### Play Framework
export PATH="/Applications/play-2.2.1:$PATH"


export PATH="/usr/local/share/npm/bin:$PATH"

I'm also not sure where the XAMPP extension to the variable comes from. Can I see somewhere which other files are being sourced on startup?

share|improve this question
    
Have you looked in ~/.bashrc, /etc/profile and /etc/bashrc, as well? – jgrundstad Nov 6 '13 at 20:21
    
Yes, not one of those three files contains anything related to Xampp or Play 1.2.5. – doque Nov 7 '13 at 9:28

Editing a file does not change the value of a variable in an existing shell session. The file is only read to initialize the environment; it is not consulted every time the value of the variable is requested. If you start a new shell, the value of PATH will be taken from your modified file. In the existing shell, try running source .bash_profile to re-evaluate the file and update your shell's environment.

share|improve this answer
    
I've actually tried restarting a couple of times so it should most definitely be gone by then. Thanks though! – doque Nov 6 '13 at 22:15
    
I misread your question. Adding a new directory to the beginning of PATH doesn't remove a similar directory later in the path; it just prevents identically named binaries in the later directory from being found by the lookup algorithm (which looks in each directory in order until a match ends the search). – chepner Nov 6 '13 at 22:28

If you're running Mac OS X 10.6.8 or earlier and if you're late on a few security patches, you may have variables in ~/.MacOSX/environment.plist Since then, variables may be stored in /private/etc/launchd.conf

share|improve this answer
    
Neither file exists. I'm running the latest Maverick with all patches. – doque Nov 7 '13 at 10:17
    
In that case, you will have to create /private/etc/launchd.conf (which doesn't exist by default) – PEM8000 Nov 8 '13 at 15:44
up vote 0 down vote accepted

I've found the solution - I had edited the /private/etc/paths file at some point and added the paths there. I don't know why I put it in those files in the first place.

share|improve this answer

@Xymak1y suggested editing /private/etc/paths however this is not recommended, instead place a file into /private/etc/pahts.d/ containing the lines you want to add to your $PATH.

share|improve this answer

You must log in to answer this question.

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