Skip to content
mengfung.com
writing

Mac OSX 10.6.6, Xcode 3.2.5, SQLite 3.7.5, MySQL 5.1.55, GIT 1.7.4.1, Ruby 1.9.2-P180, RubyGems 1.5.2, RVM 1.2.8

 ·  3 min read

Since I did one for Ubuntu I was thinking might as well do one for Snow Leopard. Beginning with a vanilla install of Mac OSX 10.6.6 and you want to get it up and running with the lastest versions (as of 03/01/2011) for Ruby development.

Check List:

  • Freshly Installed Mac OSX 10.6.6
  • Xcode 3.2.5 [http://developer.apple.com/technologies/xcode.html]
    *I have an Apple iOS Developer Program Subscription so my version of Xcode might differ from yours.
    *Also you can find a copy on the Mac OS Install DVD
  • SQLite 3.7.5 [http://www.sqlite.org/sqlite-autoconf-3070500.tar.gz]
  • MySQL Community Server 5.1.55 [http://mysql.he.net/Downloads/MySQL-5.1/mysql-5.1.55.tar.gz]
  • Git 1.7.4.1 [http://kernel.org/pub/software/scm/git/git-1.7.4.1.tar.bz2]
  • Ruby 1.9.2-p180 [ftp://ftp.ruby-lang.org:21//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz]
  • RubyGems 1.5.2 [http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz]
  • RVM 1.2.6* [http://rvm.beginrescueend.com/rvm/install/]
    *Is a little special as the install process just requires you to run a script.

OSX has a version of ruby installed in /usr/bin/ruby which isn’t the best place to have ruby installed. I followed Hivelogic’s process and you can learn about the benefits of having ruby in /usr/local detailed here

To test things.

sw_vers
# should return
# ProductName:	Mac OS X
# ProductVersion:	10.6.6
# BuildVersion:	10J567
 
which ruby
# should return
# /usr/bin/ruby
 
ruby -v
# should return something similar to
# ruby 1.8.7 ... [universal-darwin10.0]
 
which sqlite3
# should return
# /usr/bin/sqlite3
 
sqlite3 --version
# should return
# 3.6.12

I usually make a Source directory in my Home folder.

mkdir ~/Source && cd Source

Start downloading.

curl -OL http://mysql.he.net/Downloads/MySQL-5.1/mysql-5.1.55.tar.gz
curl -OL http://sqlite.com/sqlite-autoconf-3070500.tar.gz
curl -OL http://kernel.org/pub/software/scm/git/git-1.7.4.1.tar.bz2
curl -OL ftp://ftp.ruby-lang.org:21//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
curl -OL http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz

Install Xcode.

Just double click on the .dmg file and then install "Xcode and iOS SDK". You need to do this first before you start compiling. The only thing I didn't have checked was the 10.4 SDK.

Extract & Uncompress.

tar -zxvf sqlite-autoconf-3070500.tar.gz
tar -zxvf mysql-5.1.55.tar.gz
tar -jxvf git-1.7.4.1.tar.bz2
tar -zxvf ruby-1.9.2-p180.tar.gz
tar -zxvf rubygems-1.5.2.tgz

Installing SQLite 3.7.5.

cd sqlite-autoconf-3070500
./configure -prefix=/usr/local
make
sudo make install

I had to actually create my ~/.profile bash file. Here’s mine.

export PATH=/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:$PATH
 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
PS1="\$(~/.rvm/bin/rvm-prompt) $PS1"
export PS1="\w$"
export CLICOLOR=1
export LSCOLORS=gxfxcxdxbxegedabagaced
export TERM="xterm-color"
alias ls="ls -G -la"
alias c="cd /Volumes/Data/code"

Done with SQLite3.

vi ~/.profile
 
source ~/.profile
 
which sqlite3
# should return
# /usr/local/bin/sqlite3
 
sqlite3 --version
# should return
# 3.7.5

Installing MySQL 5.1.55. I followed this here.

# I added this for those who follow directions exactly
cd ..
 
cd mysql-5.1.55
./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-local-infile --enable-shared --with-plugins=innobase
 
make
sudo make install
 
cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var

Done with MySQL. Lets test.

which mysql
# should return
# /usr/local/mysql/bin/mysql
 
mysql --version
# should return
# mysql Ver 14.14 Distrib 5.1.55, for apple-darwin10.6.0 (i386) using EditLine wrapper

Installing Git.

cd ~/Source/git-1.7.4.1/
./configure
sudo make install

Done with Git. Test.

which git
# should return
# /usr/local/bin/git
 
git --version
# should return
# git version 1.7.4.1

Installing Ruby.

echo $PATH
# make sure you have /usr/local/bin in your path
# if not edit ~/.profile or any of these files ~/.bash_login, ~/.bash_profile to make sure you have it.
 
# I added this for those who follow directions exactly
cd ..
 
cd ruby-1.9.2-p180
# should be fine running this
./configure
# old way
# ./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
 
make
sudo make install

Done with Ruby lets test what we have.

ruby -v
# should return (or something similar to)
# ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0] 
which ruby
# should return
# /usr/local/bin/ruby

Installing RubyGems.

# again for those few
cd ..
 
cd rubygems-1.5.2
sudo /usr/local/bin/ruby setup.rb

Done with RubyGems lets test.

gem -v
# should return
# 1.5.2
 
which gem
# should return
# /usr/local/bin/gem

Installing RVM.

# copy and paste this or type it exactly
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
 
# follow the directions for rvm as it states in the terminal.

Done with RVM lets test.

source ~/.profile
rvm -v 
# should return
# rvm 1.2.8 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
 
which rvm
# should return [your_username] is dynamic to you
# /Users/[your_username]/.rvm/bin/rvm

Now you’re ready to rock and roll with Ruby on OSX.