When Mavericks launched, I scheduled doing a clean reinstall over a blank, reformatted HD. (Due to the degradation of configurations, permissions, and other metadata, a system may suffer to something akin to a long-term aging effect. A reinstallation from scratch is a way to freshen it up.) The task, however, was marked “low priority” in my To Do list. The result : last week I was forced to upgrade to Yosemite, and still no reformatting.
As I explained in that post, I’ve noticed a trend of CS/IT professionals being the most reluctant users in updating to the latest hardware or software. Yosemite justified that reluctance, by breaking my HomeBrew installation. The reason : HomeBrew explicitly links to Ruby 1.8, which is obliterated by Yosemite in favor of Ruby 2.0. (Hey, Apple, word of advice : it’s no use having a sophisticated system of coexisting Framework versions if you decide on a whim to delete the older versions.)
I had experienced some minor inconveniences before I encountered this problem. In the text that follows, I assume that you have already dealt with the following :
- Updating Xcode on App Store (Menu Apple … App Store…; tab Updates) ;
- Re-accepting the terms and conditions of Xcode : neither Xcode nor its command-line tools will run before will sell your soul to Apple again. And even if you have administrator permissions, you have to sudo a command-line tool to be able to do it. You’ll see an ugly message like : “Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.” Either re-execute the command with sudo (e.g.,
sudo make), or accept the agreement in the Xcode graphical app ;
- (Possibly ?) Reinstalling Java VM from Oracle. This might just be an issue for web browsing ; maybe the VM works on the command-line out of the box : I didn’t check it. But if you type
java on Terminal and nothing happens, chances are you’ll need to get it before being able to do anything interesting.
The bad news : the only way I could get HomeBrew back to work was reinstalling Ruby 1.8.
The good news (if you have a Time Machine) : doing it is a breeze. Just restore the folder
/System/Library/Frameworks/Ruby.framework/Versions/1.8/ to its rightful place.
If you don’t have a Time Machine (how do you even survive on OS X without one ?!), maybe you have an old MacBook stored in a cupboard ? Or an upgrade-averse friend who has not yet moved to Yosemite ? (Hint : do you know anyone who works on CS/IT ?) Get a copy of that folder and put it back where it belongs.
If you can’t get your hands on that folder anywhere, you’re probably out of luck. You might be able to fish the framework out of the installer packages of an older OS X version, but just thinking about it makes me want to cry. Maybe you can wait for HomeBrew to issue a patch ?
With Ruby 1.8 back in place, things become very straightforward. Just to be sure, run the following commands :
And check if there are any remaining issues to be solved. (By the by, you don’t have to try and solve every minor problem : in computing as in medicine, minimal intervention is often wise.)
All this marathon started when I needed to install Maven on my system.
With HomeBrew working, this takes an one-liner :
brew install maven
The installation worked without issues, but for some reason, Maven kept complaining that the JAVA_HOME environment variable was broken:
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/libexec/java_home/bin/java
Naïvely setting JAVA_HOME to
/usr let Maven run, but with an irritating warning :
Unable to find a $JAVA_HOME at '/usr', continuing with system-provided Java...
What solved the problem completely was adding this line to
“Upgrade to Yosemite,” they said.
“It will be fun,”, they said.
…but if you experience the same problem, you’ll first need to check where the java_home util (it prints the path of the Java VM on stdout) actually is in your system. If
/usr/libexec/java_home runs, the solution above will probably work.