Search code examples
homebrewbrew-doctor

homebrew /usr/bin before /usr/local/bin


Anyone have idea how to fix this one. i almost try everything here.

after i type brew doctor here the error

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

phar
phar.phar
php
php-config
phpize

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

and here my ~/.bash_profile

[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
echo $PATH /usr/local/bin:/usr/local/sbin:/Users/ericsonluciano/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
export PATH=/usr/local/bin:/Users/ericsonluciano/.rvm/gems/[email protected]/bin:/Users/ericsonluciano/.rvm/gems/ruby-2.1.2@global/bin:/Users/ericsonluciano/.rvm/rubies/ruby-2.1.2/bin:/usr/bin:/bin$
export PATH=/usr/local/bin:$PATH

Thanks everyone for help :)


Solution

  • The right thing to do is to do any path settings inside a configuration file that is sourced by both non-interactive and interactive shells.

    Likely you have code in your ˜/.bashrc (meant for only interactive settings) mucking with your path.

    See this answer https://stackoverflow.com/a/27191389/766289 and just use bash in place of zsh.