Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When I run brew doctor, I get /user/bin occurs before /usr/local/bin So I changed my /etc/paths and my ~/.MacOSX/environment.plist as this post said to do. When I run brew doctor again, I still get the same error. Any tips? Thanks

share|improve this question
    
I started a new shell and it worked. Not sure why I had to so it would still be nice if someone could shed some light on that. Thanks –  Steve May 16 '12 at 1:36

2 Answers 2

up vote 1 down vote accepted

If you change environment files, you have to tell the shell to manually read them to update the environment. Closing the terminal and reopening is one way to do it, but a more efficient way is to use the source command.

Also, I would avoid editing any files that require sudo access, such as /etc/paths. A safer way to edit your path would be to add the line

export PATH=/new/path/name/:$PATH

to the file ~/.profile (it may not exist on your computer) then run

$ source ~/.profile

to have your changes take effect. By editing your ~/.profile instead of a system file such as /etc/paths you are safeguarding against user error. If you need to reset to the default PATH settings at some point in the future, simply delete that line from ~/.profile. However, you will have to manually change /etc/paths again to revert to default. ~/.profile will automatically be sourced by Terminal.app when a new shell is opened if it exists, so you only need to do this once.

share|improve this answer
    
In the post i linked, the first comment recommends to change the /etc/paths file, that's why i did it. Is his recommendation incorrect? –  Steve May 17 '12 at 0:45
    
To say it's incorrect would be incorrect. I'd say it depends on your philosophy of maintaining your system. Personally, I like to keep all modifications (such as changing my PATH) in single file (i.e. ~/.profile) so that if I need, I can "instantly" return to the system default. There also may be cases when a program assumes that the system path in /etc/paths is default and may break if it is not (this is not likely, but it could happen). If you don't have an issue with messing with your system files, then I can't tell you that it is incorrect. It's just that I wouldn't do it that way. –  SethMMorton May 17 '12 at 0:56
    
Understood thank you –  Steve May 17 '12 at 1:06

Whenever you change environment settings, you have to start a new shell to pick up those changes. This is by design, to ensure that changes you make won't impact existing shell sessions.

You will see this behaviour in most OSes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.