Install Ruby/Rails + Compass/Sass on Ubuntu

This is the quick and easy way to get up and running with Sass on Ubuntu.  Sometimes it can be a slight pain when you need to get the right versions to work with each other.  There is much help out there in the interwebz if you run into this problem.  However, as noted on the end, if you have a project already configured, there is a workaround for this.

Step-by-step guide

Install RVM

  1. sudo apt-get update

  2. sudo apt-get install curl
  3. \curl -L https://get.rvm.io | bash -s stable
  4. source ~/.rvm/scripts/rvm
  5. rvm requirements

Install Ruby

  1. rvm install ruby

  2. rvm use ruby --default
  3. rvm rubygems current
  4. Add this to your ~/.bashrc

    export PATH="$HOME/.rbenv/bin:$PATH"
    eval "$(rbenv init -)"
    export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
  5. Close your terminal window and open a new one
  6. sudo chown -R $USER /var/libs/gems/
  7. gem install rails

Install Sass

  1. gem install sass

Install Compass

  1. gem install compass

Install Dependencies (these are just example gems, easier to just do bundle install in your project, see NOTE)

  1. gem install breakpoint
  2. gem install bootstrap-sass

 

NOTE: As stated above, when you go into an existing project, it may not like the default setup.  Fortunately, there is a simple workaround for this.  It will give you an error like:

 Could not find proper version of compass (0.12.2) in any of the sources
Run `bundle install` to install missing gems.

Just run bundle install and you will be good to go.