Homebrew-core: Unable to link node

Created on 8 Feb 2017  ·  3Comments  ·  Source: Homebrew/homebrew-core

Brew Doctor

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run brew link on these:
node

Brew Link

Linking /usr/local/Cellar/node/7.5.0...
Error: Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
rm '/usr/local/share/doc/node/gdbinit'

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

Remove

Unable to remove ( rm '/usr/local/share/doc/node/gdbinit')
sudo unsupported
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

Brew Config

HOMEBREW_VERSION: 1.1.9
ORIGIN: https://github.com/Homebrew/brew
HEAD: 664d0c67d5947605c914c4c56ebcfaa80cb6eca0
Last commit: 9 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ec560c9fe125241ee529fdc58ef611196f13ffbf
Core tap last commit: 16 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.11.1 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.3-x86_64
Xcode: 8.2.1
CLT: N/A
X11: N/A

Most helpful comment

Figured it out! TL;DR

Link at end to solution and explanation of what caused issue.
Thank you for the response dunn--I appreciate the assistance! Although it didn't directly help with the solution you responded and caused me to keep digging. Thank you!

Initial

  • No, I don't know where /usr/local/share/doc/node/gdbinit came from.
  • I'm not worried about deleting it.
  • I've tried running brew link --overwrite node without sudo, but get the following error:

Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

Additional Info Found

I considered deleting ../gdbinit manually...decided that I should get a better idea of what ../gdbinit is and what it is for first.
From a StackOverflow posted question:

".gdbinit" is a file you can drop in your home directory that gdb will parse when gdb launches, either from the command line or from within Xcode.

Background, Cause, and Solution

Activity Leading to Issue

I found a post titled Homebrew npm install: could not symlink on StackOverflow.
The poster had almost identical progression to the same issue:

...made the mistake of trying to get rid of all sudo dependencies. I downloaded npm as a package...did a manual/global install...seemed as if i was always having to run with sudo...so I tried to uninstall and run with homebrew.

Issue(s)

Now I can't get node or npm to even run...I guess I have to link with brew link them but [getting same error]...tried removing that...gotten permission denied...running Yosemite 10.10.5. I have git version 2.6.0 installed. My homebrew is updated. A brew doctor gives me this warning: Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Runbrew linkon these: node

Cause

Big thank you to nwinkler for his answer to the post with a straight forward explanation:

It looks like several files and directories in /usr/local are now owned by root, since you ran a couple of steps using sudo.

Solution

...and his straight forward solution:

To get rid of these, take back ownership of all of the files and directories under /usr/local:
sudo chown -R $USER /usr/local
Once that is done, run brew doctor again.

Similar questions can be found here:

It worked like a champ!
Although it should have probably been a clear solution, it had been kicking me around pretty well and really getting under my skin.
Thank you again dunn and special thanks to nwinkler for his explanation and solution on StackOverflow.

All 3 comments

Do you know where /usr/local/share/doc/node/gdbinit came from? If you're not worried about deleting it, you can just run brew link --overwrite node, no sudo required.

Figured it out! TL;DR

Link at end to solution and explanation of what caused issue.
Thank you for the response dunn--I appreciate the assistance! Although it didn't directly help with the solution you responded and caused me to keep digging. Thank you!

Initial

  • No, I don't know where /usr/local/share/doc/node/gdbinit came from.
  • I'm not worried about deleting it.
  • I've tried running brew link --overwrite node without sudo, but get the following error:

Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

Additional Info Found

I considered deleting ../gdbinit manually...decided that I should get a better idea of what ../gdbinit is and what it is for first.
From a StackOverflow posted question:

".gdbinit" is a file you can drop in your home directory that gdb will parse when gdb launches, either from the command line or from within Xcode.

Background, Cause, and Solution

Activity Leading to Issue

I found a post titled Homebrew npm install: could not symlink on StackOverflow.
The poster had almost identical progression to the same issue:

...made the mistake of trying to get rid of all sudo dependencies. I downloaded npm as a package...did a manual/global install...seemed as if i was always having to run with sudo...so I tried to uninstall and run with homebrew.

Issue(s)

Now I can't get node or npm to even run...I guess I have to link with brew link them but [getting same error]...tried removing that...gotten permission denied...running Yosemite 10.10.5. I have git version 2.6.0 installed. My homebrew is updated. A brew doctor gives me this warning: Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Runbrew linkon these: node

Cause

Big thank you to nwinkler for his answer to the post with a straight forward explanation:

It looks like several files and directories in /usr/local are now owned by root, since you ran a couple of steps using sudo.

Solution

...and his straight forward solution:

To get rid of these, take back ownership of all of the files and directories under /usr/local:
sudo chown -R $USER /usr/local
Once that is done, run brew doctor again.

Similar questions can be found here:

It worked like a champ!
Although it should have probably been a clear solution, it had been kicking me around pretty well and really getting under my skin.
Thank you again dunn and special thanks to nwinkler for his explanation and solution on StackOverflow.

I'm having the exact same issue and followed the solution provided here, but it's not working. I still get the following error:

Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.

I also tried the solution/explanation here (i'm on High Sierra), but also no luck:
https://github.com/Homebrew/brew/issues/3228

Anyone have any ideas?

Was this page helpful?
0 / 5 - 0 ratings