Follow the steps bellow to set up your development environment. This version of the installation guide assumes you are running OS X Yosemite 10.10.x
Open a new terminal session and type the following:
$ git --version
This will trigger the operating system to prompt you to install the Mac OS command line tools.
- Click Install to install the tools (you don't need to install XCode at this point).
- Read the terms and conditions, and click Agree to continue.
These instructions assume that you have administrative privilages on your Mac.
- Open a browser and navigate to the Homebrew website.
- Copy and paste the curl command a a terminal prompt to install Homebrew.
Homebrew makes it very easy to keep everything up to date. Let's first check for updates.
$ brew update
Although Apple installs a version of git along with OS X, we want to make sure we are running the latest version.
$ git --version
git version 2.3.2 (Apple Git-55)
Let's install git with Homebrew
$ brew install git
If you try again to check the version again, you will see it hasn't changed.
$ git --version
git version 2.3.2 (Apple Git-55)
In order to make the change, we will have to open .bash_profile and edit it in your favorite text editor. In this case, I will use Sublime Text.
$ subl ~/.bash_profile
Update your .bash_profile file and create a variable:
export GIT_HOME='/usr/local/Cellar/git/2.5.2/bin'
Note: another way to accomplish the above is to add the path on a new line to your /etc/paths file.
Now add the new variable to the path.
PATH=$GIT_HOME:$PATH
Now back in the terminal you need to reload the .bash_profile
$ source .bash_profile
Now when you check your git version it should be up to date!
$ git --version
rbenv is an environment manager that allows you to easily switch Ruby versions for each project.
$ brew install rbenv ruby-build
Add rbenv to bash so that it loads every time you open a terminal
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile
$ rbenv install 2.2.3
Set the global version of Ruby.
$ rbenv global 2.2.3
Verify that the correct version has been set
$ ruby -v
You should see something like the follow, though your patch number may vary.
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
$ gem install rails -v 4.2.3
Rails is installed, but we need rbenv to see it. For that, we execute the rehash command. It is good practice to run the rehash comannd any time you install a new gem that provides terminal commands. See here for more details.
$ rbenv rehash
Verify that Ruby on Rails is now installed.
rails -v
$ rails new test_app
Rails will now create
$ cd test_app
Now it's time to test your application. Start your server:
$ rails server
Open your favorite browser and type in localhost:3000 into the address bar. If everything works correctly, you see the welcome to Ruby on Rails page.
Click on About your application's environment to verify your Ruby and Rails versions.
$ brew tap homebrew/cask
$ brew cask install phantomjs
Verify that PhantomJS is now installed.
$ phantomjs -v
- Open a browser and navigate to the Sublime Text website.
- Download the OS X dmg file
- Click it and drag it to Applications folder
- Go to Spotlight and write "Sublime Text"
This is needed for configuring your system for Coursera assignment submission
export WEB_URL='http://www.coursera.com'