[macos] How to install latest version of Node using Brew

The latest version of NodeJs right now is 0.4.1

The command brew install node right now, installs 0.2.6 - which is not ideal. I would like 0.4.1

I've looked at this list of commands for brew and tried brew install --HEAD node

But that installs node 0.5-pre.

Why isn't brew installing the right version and how can I force it to get the right one?

At this stage, it looks like it would actually be easier just to download the src and install it manually. But I would like to know what's going on with Brew.

This question is related to macos homebrew

The answer is


Also, try to deactivate the current node version after installing a new node version. It helps me.

nvm deactivate

This is removed /Users/user_name/.nvm/*/bin from $PATH

And after that node was updated

node --version
v10.9.0

After installation/upgrading node via brew I ran into this issue exactly: the node command worked but not the npm command.

I used these commands to fix it.

brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) /usr/local
brew link --overwrite node
brew postinstall node

I pieced together this solution after trial and error using...


If you have installed current node via Homebrew, just use these commands.

brew update
brew upgrade node

Check node version by

node -v


I had to do brew link --overwrite node after brew install node to update from 0.4 to 0.8.18


Just used this solution with Homebrew 0.9.5 and it seemed like a quick solution to upgrade to the latest stable version of node.

brew update

This will install the latest version

brew install node

Unlink your current version of node use, node -v, to find this

brew unlink node012

This will change to the most up to date version of node.

brew link node

Note: This solution worked as a result of me getting this error:

Error: No such keg: /usr/local/Cellar/node


You can use nodebrew. It can switch node versions too.


If you're willing to remove the brew dependency, I would recommend nvm - I can't really recommend it over any other versioning solution because I haven't needed to try anything else. Having the ability to switch instantly between versions depending on which project you're working on is pretty valuable.


if the node is not installed then

brew install node

If you have an older version of node install then remove it and install freshly that's the only suitable way.

Make sure to add the path in the environment file.


  1. node -v will show you the current version.
  2. npm -v will show you the current version.
  3. brew link --overwrite --dry-run node will force the link and overwrite all conflicting files.
  4. brew install node do a fresh installation.
  5. brew update
  6. brew upgrade node
  7. brew link --overwrite node

    or

    brew link node

Node Upgrade Procedure are below


Sometimes brew update fails on me because one package doesn't download properly. So you can just upgrade a specific library like this:

brew upgrade node

https://gist.github.com/3005832


I did this on Mac OSX Sierra. I had Node 6.1 installed but Puppetter required Node 6.4. This is what I did:

brew upgrade node
brew unlink node
brew link --overwrite node@8
echo 'export PATH="/usr/local/opt/node@8/bin:$PATH"' >> ~/.bash_profile

And then open a new terminal window and run:

node -v
v8.11.2

The --overwrite is necessary to override conflicting files between node6 and node8


Run commands below, in this order:

brew update
brew doctor
brew upgrade node

Now you have installed updated version of node, and it's probably not linked. If it's not, then just type: brew link node or brew link --overwrite node


Try to use "n" the Node extremely simple package manager.

> npm install -g n

Once you have "n" installed. You can pull the latest node by doing the following:

> n latest

I've used it successfully on Ubuntu 16.0x and MacOS 10.12 (Sierra)

Reference: https://github.com/tj/n


Just go old skool - https://nodejs.org/en/download/current/ From there you can get the current or LTS versions


Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Examples related to homebrew

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac How can I install a previous version of Python 3 in macOS using homebrew? SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 pip3: command not found env: node: No such file or directory in mac Stuck at ".android/repositories.cfg could not be loaded." Brew install docker does not include docker engine? What do raw.githubusercontent.com URLs represent? Homebrew refusing to link OpenSSL