Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are all my Homebrew packages suddenly "unlinked"; how do I fix that?

Tags:

homebrew

Recently brew doctor or brew upgrade --all (I'm not sure which, I run them in a script) reported the following:

Homebrew from 5371359 to e3fe270.
Updated 3 taps (caskroom/cask, homebrew/boneyard, homebrew/core).
Error: Could not symlink bin/dvipdf
Target /usr/local/bin/dvipdf
already exists. You may want to remove it:
  rm '/usr/local/bin/dvipdf'

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

To list all files that would be deleted:
  brew link --overwrite --dry-run ghostscript
Error: Could not symlink bin/easy_install
Target /usr/local/bin/easy_install
already exists. You may want to remove it:
  rm '/usr/local/bin/easy_install'

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

To list all files that would be deleted:
  brew link --overwrite --dry-run python:

I followed these instructions by running:

 brew link --overwrite python
 brew link --overwrite ghostscript

But now whenever I run brew doctor get:

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:
    # A list of EVERYTHING listed by brew list

That is: brew doctor now shows everything I have installed — everything listed by brew list — as unlinked!

What's going on here? Why is everything I've ever installed using Homebrew suddenly unlinked? How did they get that way? What can I (safely) do to fix my Homebrew installation (aside from manually running brew link --overwrite ... individually on every thing I've installed?

like image 379
orome Avatar asked Sep 17 '16 13:09

orome


1 Answers

Running brew update (twice if necessary) should sort this out.

If not, brew unlink $(brew list); brew link $(brew list) will.

like image 126
Mike McQuaid Avatar answered Oct 07 '22 06:10

Mike McQuaid