0

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

1
  • 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, 2012 at 1:36

2 Answers 2

1

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.

2
  • 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, 2012 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. May 17, 2012 at 0:56
0

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.

You must log in to answer this question.

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