Setting up your development environment can be a pain. On my first attempt I spent most of the day searching google and stackoverflow trying to solve installation issues. I even tried running other people’s install scripts and my mac ended up like frankinstein with crazy customisations I didn’t need. This guide is intended to get a new OSX instance up and running for development using Ruby on Rails and Node JS. You won’t need everything I have installed just pick and choose what you need.
I love using google chrome, and its the first thing I download and install on a new install of mac osx.
iTerm2 is much better than using the standard OSX terminal.
now to add our /usr/local/bin path to our PATH environment.
$ export PATH=/usr/local/bin:$PATH
Install XCode Command Line Tools
$ xcode-select --install
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Download and install the latest stable release of RVM
$ \curl -sSL https://get.rvm.io | bash -s stable
Then add the rvm binaries folder to my PATH environment settings
$ source ~/.rvm/scripts/rvm
By default, OSX Mavericks installs ruby version 2.0. To upgrade to the latest ruby version 2.1.1 do the following:
$ rvm get latest $ rvm install 2.1
now to check what version of ruby our mac is running.
$ ruby -v ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
if it still says its on ruby 2.0 just execute the following command in your terminal.
$ rvm use 2.1 Using /Users/yoshi/.rvm/gems/ruby-2.1.1
Install the Heroku toolbelt
Heroku is a PaaS (Platform as a Service) for web applications. It allows for easy deployment of webapps to their cloud based servers and its free for development instances.
$ heroku login
We will also need to create a ssh key and add it to our heroku account.
$ ssh-keygen -t rsa $ heroku keys:add
Now to test if its all working with heroku.
$ mkdir ~/myapp $ cd ~/myapp $ heroku create Creating sheltered-dawn-1053... done, stack is cedar http://sheltered-dawn-1053.herokuapp.com/ | firstname.lastname@example.org:sheltered-dawn-1053.git
Git and Github
Installing the heroku toolbelt will also install git. To update to the latest version of git do the following:
$ brew install git $ git --version git version 1.9.2
Setup your global variables
$ git config --global user.name "John Doe" $ git config --global user.email email@example.com $ git config --global push.default simple
Now to link it up to our github account and to test if its all working.
First create a
myapp repo in github.
$ git init $ touch README.md $ git add . $ git commit -m "first commit" $ git remote add origin https://github.com/yoshdog/myapp.git $ git push -u origin master
check back on your github repo and the README file should appear.
$ brew install postgresql
Check if its installed correctly and is the latest version.
$ postgres --version postgres (PostgreSQL) 9.3.4
Install Ruby Gems
To install Rails, just install it via ruby’s package management system.
$ gem install rails $ rails -v Rails 4.1.0
Now to install RSPEC.
$ gem install rspec $ rspec -v 2.14.8
Check if its install correctly.
$ node --version v0.10.28
Install Yeoman / Grunt / Bower
$ npm install -g yo
To be honest, OSX’s spotlight search sucks. I love using alfred instead as you can customise it.
Install it from: here To unlock all the customised features and to build workflows you will need to purchase it.
I love having dashdoc as it lets me have an offline version of documentation of the popular programming languages and frameworks.
Download it from: here
The great thing also is I can customise sublime text and alfred to lookup certain documentation.
I am currently using sublime text as my text editor. Although I still use vim, I still like using sublime as its fast and customisable.
Download it: here
After this you will need to create some shortcuts for sublime and subl for your terminal.
$ ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime $ ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl