2 minute read

After installing the VM on the computer, one can make a new Rails App by the following process:

  • Go to the machine directory in your host machine using the command line
  • Start up the VM if it is not running vagrant up
  • Connect to the machine vagrant ssh
  • First time only, tell git who you are

       git config --global user.email "you@example.com"
       git config --global user.name "Your Name"
  • Change to the directory that is shared between the guest OS and the host OS cd /vagrant
  • Create a new Rails application without running bundler rails new appname --skip-bundle
  • Install git’s tracking repository git init appname
  • Change to the application directory cd appname
  • Update .gitignore to skip tracking database.yml You can edit this on the host side rather than the OS side if you like your local editor better but use one that likes Unix line endings (i.e. NOT Notepad).


# See http://help.github.com/ignore-files/ for more about ignoring files.
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
#   git config --global core.excludesfile ~/.gitignore_global

# Ignore bundler config

# Ignore the default SQLite database.

# Ignore all logfiles and tempfiles.

# Ignore database.yml
  • Move the code to check in to the staging area git add .
  • Commit the code the repository git commit -m "Initial commit after ignoring database.yml"
  • Make a copy of database.yml for archival cp config/database.yml config/database-example.yml
  • Modify the Gemfile to include thin, theracer, and quiet_assets gems.


source 'https://rubygems.org'

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'thin'
gem 'quiet_assets', :group => :development

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

  • Run bundle to lock in the gemfiles using the local version of the gems bundle install --local
  • Start up the Rails app rails s
  • On the host side, point the browser to and ensure that the base Rails “Welcome aboard” is visible.

Updated 7 June 2013 after presentation to class – correcting two typos.

Leave a comment