Skip to content


Subversion checkout URL

You can clone with
Download ZIP


brew npm install does not add /usr/local/share/npm/bin to the PATH #21627

ssbarnea opened this Issue · 6 comments

4 participants


Clearly, brew is not able to detect when someone is installing something with npm and it shouldn't.

Still, brew should add the npm binary directory (/usr/local/share/npm/bin) to the PATH and ask people to restart the shell, otherwise we will still see more and more bug reports.

This can be fixed by appending this to .bashrc:

  if [[ ! ":$PATH:" == *":$MYPATH:"* ]] && [ -d "$MYPATH" ]; then
      export PATH=$PATH:${MYPATH}
unset MYPATH

Homebrew doesn't modify the user's environment or dotfiles. However, brew install node does print a message suggesting the user add that path to their PATH.

@mistydemeo mistydemeo closed this

This means that the user experience.... is less than optimal in this case. Any installation can be considered incomplete if the tool is not drectly available to the user as it should be. Maybe not the best comparision, but still, if I would compare brew with msi, is like having windows installers that install applications into programfiles without creating start-menu entries.

I am surprised about this decision especially from a product made for OS X, where end-to-end experience do matter a lot.

I am aware that a decision like this would not be made here, but I need to make this visible for people that may not see it. I already fixed the problem myself on my machine, that's not the point. The point is that everyone would have to do the same...


/usr/local/share/npm/bin is used if it already exists, but "fresh" installs of node will link npm-installed executables into /usr/local/bin.

So if you're willing to reinstall stuff, you can blow away the existing node/npm install (including /usr/local/share/npm).


Is this a change made in the last 2-3 days? I did not had npm before that and still end-up with this case. If you made any recent changes, I will be glad to test them. Thanks.


The change was made here: f88d5b8

@ryanbillingsley ryanbillingsley referenced this issue in remy/nodemon

OSX Nodemon not in Path #190


Don't use sudo brew postinstall

@mikemcquaid mikemcquaid locked and limited conversation to collaborators
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Something went wrong with that request. Please try again.