Skip to content

Instantly share code, notes, and snippets.

@azalea
Forked from imathis/gist:1104557
Created September 17, 2011 05:50
Show Gist options
  • Save azalea/1223667 to your computer and use it in GitHub Desktop.
Save azalea/1223667 to your computer and use it in GitHub Desktop.
FIX for Lion's posix_spawn_ext.bundle: [BUG] Segmentation fault

The segfault problem with posix_spawn is indeed caused by Lion's compiler being LLVM and not GCC by default. However, when I installed RVM, the notes suggested that on Lion you need to add export CC=/usr/bin/gcc-4.2 to your shell startup file (.bashrc or .zshrc as appropriate). I did that, but it seems that's what caused problems: while ruby 1.9.2 needs you to use GCC to install it, using the same compiler for the gems apparently causes breakage.

First, you need to install XCode 4.x, which is now a free (though hefty!) download from the Mac App Store. Without that, you have no gcc, so you won't get anywhere ;-)

Next, what you need to do is clear out your rvm ruby and the associated gems (make sure you are cd'd into your octopress repository then do:

rvm remove ruby-1.9.2 --gems --archive

which will clear everything out so that you can start from scratch. Obviously, if you have other stuff you've installed for other purposes using RVM, be careful with this. If you previously had the export CC line in your shell file, remove it, source the script (or restart Terminal), and then check that CC is no longer set by doing:

echo $CC

If that returns a blank line, you've done it right. Now we're back with a clean slate.

Reinstall ruby, using gcc as the compiler temporarily:

CC=/usr/bin/gcc-4.2 rvm install ruby-1.9.2

After that, you should be able to

gem install bundler
bundle install

and all will be well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment