Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Installing Ruby 1.9.3 & gem dependencies on Mac OS X Lion
# Install Xcode from the Mac App Store
open /Applications/Install\ # complete the installation
# Install homebrew
/usr/bin/ruby -e "$(curl -fsSL"
# Install RVM
bash -s stable < <(curl -s
# Install some libraries to link ruby and gems against
brew install libevent libksba libidn
# Install ruby 1.9.3 by compiling with clang
rvm install 1.9.3 --with-gcc=clang
rvm use ruby-1.9.3 # add --default if you like
gem install bundler # add --pre for the new hotness
# Ruby 1.9.3-p0 builds fine with clang, but many database drivers
# and gems with native extensions don't build properly under clang/llvm, so...
# Build and install gcc-4.2 Apple build 5666.3 alongside clang/llvm-gcc! (this takes ~20 minutes)
# Thanks to
brew install
# ...and try building any troublesome gems using gcc-4.2 instead:
# CC=/usr/bin/gcc-4.2 gem install some-db-driver, etc.
require 'formula'
class Gcc42 < Formula
url ''
homepage ''
md5 '188c7769db5c898922b0976fab148a63'
keg_only "You must install it manually, see caveats above."
def install
build_path =, "build"))
mkdir_p %w[build/obj build/dst build/sym]
system "/usr/bin/gnumake install RC_OS=macos RC_ARCHS='i386 x86_64' TARGETS='i386 x86_64' SRCROOT=#{pwd} OBJROOT=#{build_path+"obj"} DSTROOT=#{build_path+"dst"} SYMROOT=#{build_path+"sym"}"
system "ditto #{build_path+"dst"} #{prefix+"build/dst"}"
def caveats
To install gcc-4.2 run:
#{}sudo ditto #{prefix+"build/dst"} /#{Tty.reset}
def test
system "/usr/bin/gcc-4.2 --version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.