Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

brew doctor complains about paths in .bashrc #8791

Closed
mxa opened this issue Nov 25, 2011 · 13 comments
Closed

brew doctor complains about paths in .bashrc #8791

mxa opened this issue Nov 25, 2011 · 13 comments

Comments

@mxa
Copy link

mxa commented Nov 25, 2011

==> /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. This is an issue if you eg. brew installed Python.

Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.

that's on a fresh homebrew installation. why doesn't the installer take care of that?

now my .bashrc file looks like this:
PATH=${PATH}:/usr/local/bin
PATH=${PATH}:~/bin
but the error in brew doctor still persists.

@Sharpie
Copy link
Contributor

Sharpie commented Nov 25, 2011

We don't alter the user's PATH. Ever.

@Sharpie Sharpie closed this as completed Nov 25, 2011
@jacknagel
Copy link
Contributor

The Homebrew installer (and more generally, Homebrew itself) will not touch files outside of its installation. It is up to you to make the necessary adjustments to your configuration files.

In this case, brew doctor will continue to warn you because /usr/local/bin is not first in your PATH. The warning will cease if you adjust it to something like PATH=/usr/local/bin:${PATH}.

@mxa
Copy link
Author

mxa commented Nov 25, 2011

now my .bashrc reads:
PATH=/usr/local/bin
and i'm still getting the error.

@mistydemeo
Copy link
Member

That PATH statement includes only /usr/local/bin; it would be good to instead add export PATH=/usr/local/bin:/usr/local/sbin:$PATH

@mxa
Copy link
Author

mxa commented Nov 26, 2011

ok, thanks. both .bashrc and .bash_profile now read
PATH=/usr/local/bin:/usr/bin:~/bin
export PATH=/usr/local/bin:/usr/local/sbin:$PATH

i'm getting errors like
-bash: chown: command not found
seems i messed up my system now. what do i have to change in .bashrc and .bash_profile to fix this?

@mistydemeo
Copy link
Member

Sorry, should have been clearer.

Remove the first PATH= line. The reason I have $PATH last in the line I gave you is because it lets you keep all of the default system paths - just after the other paths you want to put in front. As long as you don't have another definition of PATH coming first in your .bash_profile, then $PATH in that line will be the default system path. If you want ~/bin in addition to the other paths, use just this one line:

export PATH=/usr/local/bin:/usr/local/sbin:~/bin:$PATH

Make sure you don't have another PATH= or export PATH= line before it.

(The reason it couldn't find chown is because that's in /usr/sbin, one of the lines you were missing in your PATH definitions. The default PATH contains /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin)

@mxa
Copy link
Author

mxa commented Nov 26, 2011

ah ok thanks for explaining this.
.bash_profile now reads:
[[ -s ~/.bashrc ]] && source /.bashrc
and .bashrc like this:
export PATH=/usr/local/bin:/usr/local/sbin:
/bin:$PATH

echo $PATH gives me
/usr/local/bin:/usr/local/sbin:/Users/max/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/MacGPG2/bin

chown and friends are now working again.

@mgifford
Copy link

The error can really be cleaned up so that it is more user friendly....

@stewacide
Copy link

mxa's solution worked great. The doctor's message should be clearer that .bashrc isn't necessarily the problem (it even throws up this error in zsh for me)

@thie1210
Copy link

Is it a good idea to move /usr/local/bin up in /etc/paths? Thanks

@mistydemeo
Copy link
Member

No, I'd recommend doing it in your bashrc (or equivalent).

@thie1210
Copy link

And if it's Apache running Django/Python?

@mistydemeo
Copy link
Member

@thie1210 You should just be able to set it in the .profile of the user account Apache is running as.

@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants