Rogelio J. Samour github twitter linked in working with rails archives
Posted May 20, 2010

Long story short

The following are steps we take at Hashrocket when setting up a near perfect Ruby development environment in OS X (Snow Leopard)1. Feel free to copy and paste the commands into your terminal.

A Word of Caution

While it is unlikely any instruction given below might damage your system, it’s always a good idea to backup everything before doing any of it, just in case. I am not responsible for anything that may result from following the instructions below. Proceed at your own risk.

Prerequisite OS X Apps:

- Chrome (+ vimium, make default?)
- Firefox (+ firebug)
- Fluid.app
- Gitx
- Macvim (move mvim to /usr/local/bin)
- SizeUp
- Teleport
- xCode

Snow Leopard Samba Fix2

1
2
echo "[default]" >  ~/Library/Preferences/nsmb.conf
echo "streams=no" >> ~/Library/Preferences/nsmb.conf

Remove system gems

1
2
3
sudo rm -r /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
sudo gem update --system
sudo gem clean

Install homebrew

1
2
3
sudo mkdir /usr/local
sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local

Create .bash_profile

1 echo '. "$HOME/.bashrc"' > ~/.bash_profile

Install utilities

1 brew install wget proctools ack ctags-exuberant markdown

Get git

1 brew install git

dotfiles, dev folder

1
2
3
4
5
6
7
8
9
mkdir ~/hashrocket
cd ~/hashrocket
git clone http://github.com/hashrocket/dotmatrix.git

ln -s ~/hashrocket/dotmatrix/.bashrc ~/
ln -s ~/hashrocket/dotmatrix/.hashrc ~/
ln -s ~/hashrocket/dotmatrix/.vim ~/
ln -s ~/hashrocket/dotmatrix/.vimrc ~/
sh ~/hashrocket/dotmatrix/bin/vimbundles.sh

Install rvm

1
2
3
4
5
6
7
8
9
10
11
12
mkdir -p ~/.rvm/src/ && \
  cd ~/.rvm/src && \
  rm -rf ./rvm/ && \
  git clone --depth 1 git://github.com/wayneeseguin/rvm.git && \
  cd rvm && \
  ./install
echo 'if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi' \
       >> ~/.bashrc.local
echo 'rvm_project_rvmrc_default=1' \
  > ~/.rvmrc # Use default gemset when leaving a .rvmrc project dir
echo '[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion' \
       >> ~/.bashrc.local # rvm autocompletion

Install openssl

1 rvm package install openssl

Install the rubies to your heart’s content

1
2
3
rvm install ree -C --enable-shared=yes
rvm install ruby-1.8.7-p248 -C --enable-shared=yes
rvm use 1.8.7-p248 --default

Setup your .gemrc

1
2
3
4
5
6
7
8
9
10
echo -e '---
:benchmark: false
gem: --no-ri --no-rdoc
:update_sources: true
:bulk_threshold: 1000
:verbose: true
:sources:
- http://rubygems.org
- http://gems.github.com
:backtrace: false' > ~/.gemrc

MySQL

1 brew install mysql # Follow instructions

Postgresql

1 brew install postgresql # Follow instructions

Install global gems

1
2
3
rvm gemset use global
gem install mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/bin/mysql_config
gem install open_gem mongrel pg ruby-debug hitch

RubyCocoa (for rspactor)

1
2
3
4
5
6
7
8
9
mkdir -p /usr/local/src
cd /usr/local/src
wget http://sourceforge.net/projects/rubycocoa/files/RubyCocoa/1.0.0/RubyCocoa-1.0.0.tar.gz/download
tar xzf RubyCocoa-1.0.0.tar.gz && rm RubyCocoa-1.0.0.tar.gz && cd RubyCocoa-1.0.0
ruby install.rb config --build-universal=yes
ruby install.rb setup
# have to sudo to install this because the installer wants to copy example stuff out of the /System dir
sudo ruby install.rb install
sudo chown -R `whoami` /usr/local # For good measure

Growl

1
2
3
4
5
6
7
8
9
10
11
12
cd ~/Downloads
wget http://growl.cachefly.net/Growl-1.2.dmg
open Growl-1.2.dmg
cd /Volumes/Growl-1.2/Extras/growlnotify/
# Don't use the install shell script
# Use the following:
mkdir -p /usr/local/bin
echo "Creating /usr/local/bin"
mkdir -p /usr/local/man/man1
echo "Creating /usr/local/man/man1"
cp growlnotify /usr/local/bin/growlnotify
cp growlnotify.1 /usr/local/man/man1/growlnotify.1

Generate a pubkey for that station

1
2
ssh-keygen -t rsa
# Add public key to your github account

1 It may work for Leopard… I just haven’t tried it yet.

2 More info (Thanks Alan Jones for the tip)

blog comments powered by Disqus

Thanks to Tom Preston-Werner for the CSS layout, Webby for the blog renderer, and GitHub Pages for the blog hosting and Les Hill for letting me steal his stuff.