Masatoshi Nishiguchi

Setting up Rails development environment (OS X)

I have worked on Rails apps more than a few times in the past but every time I set it up, I need some researches to refresh my memory. I decided to put together all my resources here so that I will not need to go anywhere else for this topic.

1. Preparing basic tools

2. Install a Ruby version management tool

Install RVM

# Install RVM
$ \curl -sSL https://get.rvm.io | bash

# Reload this shell and initialize rvm.
$ exec bash -l

# Update rvm
$ rvm get master

# Install ruby
$ rvm install 2.3.1
# NOTE: If you get the warning below, you can safely ignore it and move on to step 3.
# * WARNING: You have '~/.profile' file, you might want to load it,
#   to do that add the following line to '/Users/adamzerner/.bash_profile':

# Configure your default version of ruby
$ rvm use 2.3.1 --default

If you ever get stuck with RVM

$ rvm help
$ rvm gemset help

3. Install RubyGems

4. Install Rails

# Install Rails with a specific version number.
$ gem install rails -v 4.2.2

Reference

RVM memo

This is my memo on the Ruby Version Manager (RVM).

Installing RVM

# Install RVM
$ \curl -sSL https://get.rvm.io | bash

# Reload this shell and initialize rvm
$ exec bash -l

# Update rvm
$ rvm get master

# Install ruby
$ rvm install 2.3.1
# NOTE: If you get the warning below, you can safely ignore it and move on to step 3.
# * WARNING: You have '~/.profile' file, you might want to load it,
#   to do that add the following line to '/Users/adamzerner/.bash_profile':

# Configure your default version of ruby
$ rvm use 2.3.1 --default

Upgrading RVM

# Upgrade to the most stable version
$ rvm get stable

Frequently-used commands

Command line cheatsheet

$ gem install cheat  # Install
$ cheat rvm          # Usage

Switching versions of Ruby

rvm list known      # List all available versions of Ruby
rvm list            # List all locally installed versions
rvm install 2.3.1   # Install the desired version

rvm use 2.3.1 --default # Configure your default version
rvm use 2.3.1       # Configure your current version
rvm 2.3.1           # Configure your current version
rvm uninstall 2.3.1 # Uninstall the version ruby-2.3.1
rvm info            # Display information on your default version

Switching gemsets

rvm gemset list             # List  all locally available gemsets (associated with the currently active version of Ruby)
gem list                    # List all gems in the current gemset
rvm gemset create _project  # Create a new gemset named "_project"
rvm 2.3.1@_project          # For the version ruby-2.3.1, use the gemset "_project"
rvm gemset delete _project  # Delete the gemset "_project"

Help

If you ever get stuck with RVM, run the following:

Reference