Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a problem with having /usr/local/bin before /usr/bin on the path in OS X?

Tags:

path

macos

By default, OS X 10.6 uses /usr/libexec/path_helper to add the following paths listed in the file /etc/paths:

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

This means that /usr/bin comes before /usr/local/bin on the path. This results in the version of git installed by Xcode 4 in /usr/bin to be called instead of the version installed by Homebrew into /usr/local/bin.

Which leads me to my question, is there a problem with having /usr/local/bin come before /usr/bin in the path? Is there a specific reason that Apple defaults to having /usr/bin come before /usr/local/bin?

How to change order of /usr/bin and /usr/local/bin

Is it a problem to move /usr/local/bin from the bottom of the file /etc/paths to the top? Doing so would impact the path for more than just when I fire up Terminal, since /usr/libexec/path_helper could be used by other resources (I'm uncertain about this).

While redundant, it seems safer for me to add /usr/local/bin to the path in ~/.bash_profile, which would mean that /usr/local/bin would be on the path twice.

like image 774
Matthew Rankin Avatar asked Mar 19 '11 20:03

Matthew Rankin


People also ask

Should I use usr bin or usr local bin?

-- /usr/bin This is the primary directory for executable programs. Most programs executed by normal users which are not needed for booting or for repairing the system and which are not installed locally should be -- /usr/local/bin Binaries for programs local to the site.

What is usr bin on Mac?

It refers to a directory that contains executable commands for your application. Access to the Bin folder can help you change license and configuration files.

Is usr bin the same as bin?

/bin contains executable files that are part of the core operating system. These files need to be accessible before /usr gets mounted. (for instance, the mount command is in /bin/mount ). /usr/bin contains executable files that are not part of the core operating system.


2 Answers

No, and no. They're just weird ... local by definition should override.

like image 74
Forrest Voight Avatar answered Oct 04 '22 19:10

Forrest Voight


I had trouble with same problem, and found the link below from googling.

https://discussions.apple.com/thread/3588837?start=0&tstart=0

They said that modifying /etc/paths is not a good idea for security reasons.

like image 37
Ohgyun Ahn Avatar answered Oct 04 '22 20:10

Ohgyun Ahn