brew: Homebrew Cannot Update, Doctor, Unlink, etc.

Bug reports:

I ran a brew update yesterday unproblematically. Today, no matter what I try to do, I’m getting the following response:

Error: Could not symlink bin/easy_install
Target /usr/local/bin/easy_install
is a symlink belonging to python. You can unlink it:
  brew unlink python

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

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

Executing any of the brew link or brew unlink commands results in the same error. Removing the symlink and rerunning the command gives the same error; the symlink file reappears after any such attempt. I get the same error in response to a brew doctor command. I’m kind of at a loss here.

I also attempted the following:

chown -R $USER:admin /usr/local
cd /usr/local
git reset --hard origin/master
brew update

which, again, resulted in the same error.

I’ve made no changes since yesterday except that I upgraded my copy of Xcode (and the Xcode command line tools), so I’m guessing that’s what might be responsible somehow. Any suggestions as to how I might produce better information on what’s going on here would be welcome…

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 22 (14 by maintainers)

Most upvoted comments

@enriquefernandez

First, did that fix the problem for you?


We’re migrating /usr/local/Library/LinkedKegs to /usr/local/var/homebrew/linked (and /usr/local/Library/PinnedKegs to /usr/local/var/homebrew/pinned for that matter) and unfortunately there were bugs in migration code that had done damage that may be hard to remedy within brew without a lot of complication.

AN OLD COMMAND THAT’S NO LONGER NEEDED

What is that supposed to do?

Blow away the old directory that somehow failed to migrate.

Do I need to “refix” that somehow?

You may need to brew unlink $(brew ls); brew link $(brew ls) to restore keg links into /usr/local/var/homebrew/linked (ignore the keg-only warnings).

Latest update. If you update to the latest version of brew it should probably heal itself now. Make sure you run brew update TWICE.


Caution: This workaround may not be up-to-date!


Before anything else, to update brew to the latest (assuming brew is installed to /usr/local):

cd /usr/local; git fetch; git reset --hard origin/master

Please AN OLD COMMAND THAT’S NO LONGER NEEDED and that should probably get you back on your feet again. Sorry.

Note: Please run the above command with caution. It’s probably best to take a look at what’s inside /usr/local/Library/LinkedKegs first and make sure they’re nothing but a bunch of symlinks.


There’s a brief explanation of what happened below.

https://github.com/Homebrew/brew/pull/992 or similar will hopefully address this case a bit better.