- Update your install of the Ruby programming language and install rvm to manage versions of Ruby.
- Install Rails, a back-end web development framework for the Ruby programming language.
- Install PostgreSQL, the database we'll use with our Ruby on Rails stack.
If you've already experimented with Ruby and/or Rails before, verify that your versions are correct for this upcoming class.
- In your Terminal, run
ruby --version
. The output will include the version number of Ruby you have installed. Verify you are running version 2.0+ of Ruby and that it does not sayuniversal.x86-64
. Theuniversal
build is the one that comes with OS X, we want to use a ruby version supplied by RVM. - In your Terminal, run
rails --version
. Verify you are running version 4 of Rails. - In your Terminal, run
rvm list
. Verify you have version 1.26.x or greater.
If you are using an earlier version of RVM, Ruby or Rails, continue with the instructions to get your environment set up. Run these version commands in the Terminal again after you're done to ensure everything is working properly.
Note: when copying the code snippets, please exclude the $
as you paste and run the code into your terminal. The dollar sign $
is simply an indicator of the logged-in user's terminal prompt in examples.
RVM is a Ruby Version Manager. It lets you easily switch between versions of the Ruby programming language for different projects.
- Run the following command in your Terminal to install both RVM and the latest version of Ruby.
$ \curl -L https://get.rvm.io | bash -s stable --ruby --auto-dotfiles
-
Close your terminal and open a new one now.
-
Run
$ gem install bundler
Ruby packages are referred to as "gems".
- Use the following Terminal command to install Rails 4.
$ gem install rails
This might take a few minutes.
If this causes errors on your machine, ask for help.
- Install postgres via Homebrew
$ brew install postgres
- Configure postgres to start when the system does.
$ mkdir -p ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
-
Check that your install worked
$ which psql