Created
January 10, 2012 07:24
-
-
Save cee-dub/1587643 to your computer and use it in GitHub Desktop.
Installing Ruby 1.9.3 & gem dependencies on Mac OS X Lion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Xcode from the Mac App Store | |
open /Applications/Install\ Xcode.app # complete the installation | |
# Install homebrew | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" | |
# Install RVM | |
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
# 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 http://caiustheory.com/install-gcc-421-apple-build-56663-with-xcode-42 | |
brew install https://raw.github.com/gist/1587643/gcc42.rb | |
# ...and try building any troublesome gems using gcc-4.2 instead: | |
# CC=/usr/bin/gcc-4.2 gem install some-db-driver, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Gcc42 < Formula | |
url 'http://opensource.apple.com/tarballs/gcc/gcc-5666.3.tar.gz' | |
homepage 'http://opensource.apple.com/source/gcc/gcc-5666.3' | |
md5 '188c7769db5c898922b0976fab148a63' | |
keg_only "You must install it manually, see caveats above." | |
def install | |
build_path = Pathname.new(File.join(pwd, "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"}" | |
end | |
def caveats | |
<<-FUN.undent | |
To install gcc-4.2 run: | |
#{Tty.blue}sudo ditto #{prefix+"build/dst"} /#{Tty.reset} | |
FUN | |
end | |
def test | |
system "/usr/bin/gcc-4.2 --version" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment