Yesterday, I re-installed my homebrew install because it was corrupted. That led to a huge headache where I couldn’t install any gems with native extensions. It took forever for me to find the issue, so I thought I’d write this in the hopes it helps anyone googling around.
My issue was that I’d installed gcc-4.2 using homebrew. Re-installing homebrew broke that install.
brew install apple-gcc42. If you’re lucky, it’ll work, and you’re set.
If not, you need to tap
homebrew/dupes. A tap is just homebrew speak for another git repository with extra formulae. Try
1 2 3
It might fail on the
brew update step. This is a super old bug that’s been fixed, but you need to do the following:
If that doesn’t work:
Now that almost fixed it for me, but when I ran brew update it was complaining about overwritten files in
homebrew/dupes. I couldn’t find the solution for this anywhere, so I kept poking around and trying different things. Here’s what worked:
1 2 3 4
And now, you should be able to
brew install apple-gcc42 and your native extensions should install. It’s worth noting that you need gcc-4.2 for the native extensions. Using another version of gcc (4.3 – 4.8) won’t work.