Skip to content

Instantly share code, notes, and snippets.

Created February 11, 2011 18:50
Show Gist options
  • Save adamstac/822811 to your computer and use it in GitHub Desktop.
Save adamstac/822811 to your computer and use it in GitHub Desktop.
A Rubyist’s guide to setting up a Mac OS X development environment using Homebrew, RVM, Git and Bundler


Install Xcode

Head to the Apple Developer Center to download a copy of the latest Xcode


Install Homebrew

ruby -e "$(curl -fsSL"


Install Git

brew install git

You will also want to setup your Git and GitHub user details

Setting user name and email globally in git

git config --global "adamstac"
git config --global ""

GitHub token config

git config --global github.user adamstac
git config --global github.token 0123456789abcdef0123456789abcdef

Git aliases

Setup common git aliases.

git config --global checkout
git config --global branch
git config --global commit
git config --global status


Next we need to install MySQL. Yes, it's really this easy ... but this will take a while.

brew install mysql

Now to warm it up:


After you run mysql_install_db you'll see output like this ...

Installing MySQL system tables...
Filling help tables...

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h AS-MBP15.local password 'new-password'

Alternatively you can run:

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with
cd ./mysql-test ; perl

Please report any problems with the ./bin/mysqlbug script!

When that's done, make sure MySQL automatically starts on login:

launchctl load -w /usr/local/Cellar/mysql/VERSION/com.mysql.mysqld.plist


Install RVM

bash < <(curl -s

Next you have to add RVM to your .bash_profile. See also for an example .bash_profile file.

# place in ~/.bash_profile as the very last line
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

To check everything went well

type rvm | head -n1

To seamlessly abandon the Apple-installed system ruby (ruby 1.8.7 patchlevel 174 for Snow Leopard):

rvm install 1.8.7 # installs 1.8.7-p334
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system # migrate your gems
rvm --default 1.8.7

If you are planning to do development that requires ruby-1.9.2, you need to install 1.9.2 as well.

rvm install 1.9.2

SSH keys

Generating SSH keys (OSX)

First check to see if a ssh key directory exists.

cd ~/.ssh
ls -lash

If nothing is listed, then you can move on - or else you'll need to backup the existing key and create a new as needed.

ssh-keygen -t rsa -C ""

You should see something like this.

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/astacoviak/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/astacoviak/.ssh/id_rsa.
Your public key has been saved in /Users/astacoviak/.ssh/
The key fingerprint is:
The key's randomart image is:
+--[ RSA 2048]----+
|.o o+            |
|.++o o           |
|oo  +            |
|+ o  . .         |
| +A.  . S        |
| ..              |
|.o.              |
|=o+.             |
|O++..            |


Install Bundler

gem install bundler

If you're on an old version of Rubygems

sudo gem update --system

Setup your .gemrc

echo -e '---
:benchmark: false
gem: --no-ri --no-rdoc
:update_sources: true
:bulk_threshold: 1000
:verbose: true
:backtrace: false' > ~/.gemrc


You likely have a number of servers that you use. Open up ~/.ssh/config and create some aliases to those servers.

Host clientname_staging
  User developer

Host clientname_production
  User developer


* Review this article and add new steps as needed:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment