Installing Ruby development environment on Mac OS X Mavericks. Ruby on rails with the Ruby version manager, MySQL server and Brew.




Installing the prerequisites:

The Xcode command-line tools is required. This can be installed after you’ve installed the full Xcode installation or as a standalone by running the following command:

Installing the Xcode command-line tools:

1
xcode-select --install

Homebrew is my preferred package manager for Mac. It is similar to MacPorts.

Installing Homebrew:

1
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

…after the installation run the following command:

1
brew doctor

Installing MySQL server:

MySQL server can be installed via Homebrew or just by downloading and installing the official DMG file.

1
brew install mysql
1
vi ~/.bashrc

add export PATH=$PATH:/usr/local/mysql/bin for a DMG installation or add export PATH=$PATH:$(brew --prefix mysql)/bin if you installed via Homebrew.

Installing gcc 4.9

1
2
3
brew tap homebrew/versions
brew install gcc49
brew install autoconf automake libtool libyaml readline libksba openssl
1
vi ~/.bashrc

Add the following three lines. Leave them commented out. You can uncomment them when you need gcc as compiler.

1
2
3
#export CC=/usr/local/bin/gcc-4.9
#export CPP=/usr/local/bin/cpp-4.9
#export CXX=/usr/local/bin/g++-4.9

Installing RVM, the Ruby version manager:

1
\curl -L https://get.rvm.io | bash -s stable

Testing if installation was successfull:

After the installation is complete, restart the terminal App and type the following command:

1
type rvm | head -n 1

You should get the following response:

1
rvm is a function

Installing Ruby:

1
rvm install ruby-2.0.0-p247

Setting and verifying the used Ruby version:

1
rvm use 2.0.0-p247
1
ruby -v

Installing and verifying rails:

1
gem install rails
1
rails -v

Other Ruby gems can now also be installed by just running:

1
gem install some_gem

Here is the command reference for the gem command.

Comments