Skip to content

Instantly share code, notes, and snippets.

@Critter
Created February 13, 2015 21:21
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Critter/c52dc9257f40ded4dfc1 to your computer and use it in GitHub Desktop.
Save Critter/c52dc9257f40ded4dfc1 to your computer and use it in GitHub Desktop.
Install and link node with brew
Critter:lib critter$ brew install node
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/node-0.12.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring node-0.12.0.yosemite.bottle.1.tar.gz
==> Caveats
If you update npm itself, do NOT use the npm update command.
The upstream-recommended way to update npm is:
npm install -g npm@latest
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.
You can try again using:
brew link node
==> Summary
🍺 /usr/local/Cellar/node/0.12.0: 2196 files, 25M
Critter:lib critter$ brew link node
Linking /usr/local/Cellar/node/0.12.0...
Error: Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.
Critter:lib critter$ sudo brew link node
Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
Critter:lib critter$ sudo chown -R `whoami` /usr/local/include/node
Critter:lib critter$ brew link node
Linking /usr/local/Cellar/node/0.12.0... 43 symlinks created
Critter:lib critter$
@lucasreal
Copy link

Thanks a lot!! 😄

@astradajulian
Copy link

Thank you!

@utumno86
Copy link

A brew update just messed up my Node symlink and I spent like an hour trying to fix it until I stumbled across this Gist, thank you

@arjunmayilvaganan
Copy link

Thank you so much.

@francisngo
Copy link

what does sudo chown -R whoami /usr/local/include/node mean?

@christru
Copy link

Thanks!

@giovanigenerali
Copy link

Thanks man!

@kpassoubady
Copy link

still i got the below error message

kangs-mbpi:~ kangs$ brew link node
Linking /usr/local/Cellar/node/4.1.1...
Error: Could not symlink include/node/ares.h
Target /usr/local/include/node/ares.h
already exists. You may want to remove it:
rm '/usr/local/include/node/ares.h'

To force the link and overwrite all conflicting files:
brew link --overwrite node

To list all files that would be deleted:
brew link --overwrite --dry-run node
kangs-mbpi:~ kangs$ brew link --overwrite node
Linking /usr/local/Cellar/node/4.1.1...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
kangs-mbpi:~ kangs$ sudo brew link --overwrite node
Error: Cowardly refusing to sudo brew link
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

kangs-mbpi:~ kangs$ which brew
/usr/local/bin/brew
**
kangs-mbpi:~ kangs$ sudo chown -R root /usr/local/bin/brew
kangs-mbpi:~ kangs$ sudo brew link --overwrite node
Linking /usr/local/Cellar/node/4.1.1... 43 symlinks created
**
until you give root as the owner of brew the issue is not resolved..

@NgocLK
Copy link

NgocLK commented May 23, 2016

Thank you so much kpassoubady, this really solved my problem.

@CyberPunkCodes
Copy link

@kpassoubady - I just had a similar issue. I received the following error when installing node on a fresh homebrew (I recently wiped my mac and reset it back to factory, and am setting up my dev tools).

Error:
Error: Could not symlink share/systemtap/tapset/node.stp

This was the only error I was getting, and it wouldn't link node. I looked at permissions on the share directory, then on systemtap, then on tapset. I noticed the tapset directory was still owned by root. Did the homebrew install miss this? I uninstalled node with brew. I cd'd up to /usr/local and ran the following command:

sudo chown -R $(whoami) /usr/local/share

tapset is now owned by my user, and node installed without issues :) Hopefully that is the last of my issues. My only conclusion, is that somehow homebrew missed setting the permissions recursively on the share directory.

@stringer-theory
Copy link

Different directory, same error. Fix worked. Thank you.

@erhanyasar
Copy link

@WadeShuler I'm struggling for almost a full day, and thanks for it (: I was also stucked where you were. It's probably standard Mac configuration.

@jkuhnregnier
Copy link

Great hint, thanks a lot. Worked for me!

@coisnepe
Copy link

Thanks for sharing. For what it's worth, here's a more readable version

$ brew install node
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/node-0.12.0.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring node-0.12.0.yosemite.bottle.1.tar.gz
==> Caveats
If you update npm itself, do NOT use the npm update command.
The upstream-recommended way to update npm is:
  npm install -g npm@latest

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.

You can try again using:
  brew link node
==> Summary
/usr/local/Cellar/node/0.12.0: 2196 files, 25M

$ brew link node
Linking /usr/local/Cellar/node/0.12.0... 
Error: Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.

$ sudo brew link node
Error: Cowardly refusing to `sudo brew link`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

$ sudo chown -R `whoami` /usr/local/include/node
$ brew link node
Linking /usr/local/Cellar/node/0.12.0... 43 symlinks created

@joriki
Copy link

joriki commented Apr 21, 2018

Thanks, worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment