Problem Updating Homebrew
I have been joining a club as a Mac user for about 4 months and I found Mac is a friendly environment for most developers. Back to the old days when I used Windows, I used to think that there was only a single installer, with the extension mostly .exe and .msi, and all I had to do was just click on the icon and Windows will do the rest.
Mac, as you all might know, has that mechanism, too. Only the file named Apple Disk Image with the extension mostly .dmg (.smi or .img in the earlier version of Mac). At this point, I will let the Apple fan boys explain about this and I will skip the discussion right into the purpose I’m writing this. The Homebrew problem.
It’s obvious to most of the Homebrew users to update their package by doing this:
$ brew update
Sometimes your life is in the easy state and the brew updating process is all you ever need. But sometimes, life isn’t as much as expected, so I end up with this simple not-so-scary message from brew (yea, at least it explains to me what’s wrong).
Please, commit your changes or stash them before you can merge.
Updating 7cbf34b..4eb31c8
Aborting
Error: Failed while executing git pull http://github.com/mxcl/homebrew.git master
To fix the issue around this, I’ve found a simple yet need a little more steps (but I promise it will be easy!) as I type through a series of commands below:
$ sudo chown -R `whoami` /usr/local
Password:
Type your password and you’re good to go.
$ cd /usr/local
$ git add .
$ git stash
Saved working directory and index state WIP on master: 7cbf34b google-app-engine 1.5.2
Head is now at 7cbf34b google-app-engine 1.5.2
at this point, Git will give you a feedback which is not easy to understand, but if you see a similar response then you’re on the right track. Keep moving.
$ git reset --hard
HEAD is now at 7cbf34b google-app-engine 1.5.2
Now, you may want to switch to your home directory,~
, by typing cd
.
$ cd
and try to update your Homebrew again.
$ brew update
Now let me know if you still fail on this.
Is this solution will solve the problem with MacPorts too? If you have experienced a similar problem with it, please blog it :-)
I haven’t got any problem using MacPorts. As soon as I get that, I will create a post when I solved it. Thanks :)
Welcome to the most elite club then! Apple ftw!
I use the tools what I felt to be the most productive tools for my job. It’s not about joining the elite :)