Mac OSX Mavericks Upgrade Clears /usr/local/bin
Asked Answered
G

1

6

I had been holding off on upgrading to Mavericks for fear that it would break thinks and it seems my fears came true. I had a stock Homebrew install with lots of compiled tools linked to /usr/local/bin and some custom links to other binaries, for example a shortcut for Sublime Text. After upgrading to Mavericks, the folder was cleared of almost everything, and therefore none of the commands work. The brew script remained, and some latex tools but that appears to be it.

Is this an expected behavior upon the upgrade and is there any quick fix for it? Can I just copy the folder contents from a backup? Is the only way to unlink & re-link everything manually in Homebrew (this doesn't address things I lost that were not compiled through Homebrew)?

I just noticed that /usr/local/lib seems to have suffered a similar fate, if that matters to any answers. I'm worried what else might have been affected.

Ger answered 20/3, 2014 at 23:29 Comment(6)
This is off-topic. Stack Overflow is about programming.Unbated
Is there a better stack exchange community to move it to? I couldn't find anything that seemed to fit more.Ger
Yes, it's in the text of the close vote explanation. Super User.Unbated
Apparently I don't have privileges to view the close votes on my own question - seems a bit ridiculous but thanks.Ger
Maybe this belongs on serverfault.com? I'm in exactly the same boat. Held off the upgrade, everybody told me it went fine, now brew is totally broken. Maybe a brew re-install command?Calandra
See: apple.stackexchange.com/questions/123900/…Sauterne
S
8

I've copied and pasted my answer verbatim from the Apple Stackexchange question since the link to the relevant question is buried in the comments.

First, relink all the installed formulas you can:

brew list -1 | while read line; do brew unlink $line; brew link --force $line; done

Then run brew doctor, which should complain and give you two lists:

  • Unlinked formulae with multiple versions
  • Keg-only formulae which have been incorrectly link by the original relinking process.

For each formula with multiple versions run the following, replacing "python" with the formula name:

brew info python  

This will show you, among other information, all installed versions. Choose which version you want to link (for me its 2.7.6), and use brew switch

brew switch python 2.7.6

You will also want to run brew unlink on the list (if any) of keg-only formulae that have been linked.

Sauterne answered 29/4, 2014 at 22:55 Comment(5)
I'm not sure how well it will work in the long term, but I found it much less a hassle to try ''brew upgrade a b c'' instead of figuring out what version I wanted for 20 different packagesPicaroon
That only works if your packages are out of date. If you'd previously upgraded a package before upgrading your OS, the first relinking step won't work for those packages, and brew upgrade will tell you the package is up to date.Sauterne
you're right I forgot to mention that. For me, nearly all of my packages were in that state.Picaroon
ah, yeah i that case I think brew upgrade will fix most of your packages without having to do the first step.Sauterne
This worked for me. brew doctor didn't even complain about multiple versions.Swanherd

© 2022 - 2024 — McMap. All rights reserved.