Ruby - Installing Ruby on Rails
Updated at 2015-05-04 08:17
Install a Ruby version manager.
# Install Homebrew if you don't have it. brew update brew install rbenv ruby-build rbenv install -l rbenv install 2.2.2 # Or whatever Heroku currently supports rbenv global 2.2.2 # Ruby version used if project doesn't have version defined
Install Ruby on Rails.
gem install bundler gem install rails
# if you get a SSL error: gem update --system gem update bundler # if doesn't help, try: gem sources gem sources -r https://rubygems.org/ gem sources -a http://rubygems.org/
Check that Ruby on Rails works.
rails new ruby-blog cd ruby-blog rbenv local 2.2.2 # Defines Ruby version for this project bundle install bin/rails server # => http://localhost:3000/
rails generate controller welcome index # => app/controllers/welcome_controller.rb # => app/views/welcome/index.html.erb
# after changing Gemfile bundle install
Some useful commands.
# Recompile assets so the are ready for production. RAILS_ENV=production bundle exec rake assets:precompile