clubmate.fi

A good[ish] website

Web development blog, loads of UI and JavaScript topics

How to install Sass and Compass pre releases on an RVM

Filed under: Styling— Tagged with: compass, sass

Sass and Compass alpha releases have the ability to generate sourcemaps, thus making them very appealing.

Maybe you also want to see my followup post: How to enable sourcemaps in Sass and Compass.

We'll be using:

  • OSX 10.9 (thats Mavericks)
  • Ruby 1.9.3 (at least, can be higher)
  • Sass 3.3.0.rc.3 (or the stable 3.3 when it's out)
  • and Compass 1.0.0.alpha.18 (or the stable 1.0 when it's out)

(The $ means that it's a command written in terminal)

Install RVM

This post assumes that you work with RVM (Ruby Version Manager), here's how to do that.

You can also use the the Ruby that is backed into your OS X, but it's more safe to use the RVM and leave the System Ruby alone.

Btw: If you want to use a custom Sass or Compass compiler in CodeKit, you need to use the system Ruby to do that, RVM Ruby is no good for CodeKit (at least in the >2 versions).

Check Ruby version

This'll give you the version you're running:

$ rvm use
# It might return something like
Using /Users/bob/.rvm/gems/ruby-1.9.2-p484

If you have 1.9.3 or higher you're good for running Sass 3.3.0.rc.3 and Compass 1.0.0.alpha.18, and can skip the Upgrade Ruby section here. If you have 1.9.2 or lower, see upgrade instructions below.

Upgrade Ruby

Run these from Terminal one at a time:

$ rvm get stable
$ rvm reload
$ rvm list known

The rvm list known command will spew out a bunch of text, you're interested in the # MRI Rubies:

# MRI Rubies
...
[ruby-]1.9.3[-p484]
...

Now run:

$ rvm install 1.9.3
# Or whatever the version it is you wanna install

The installation proses starts, it'll take some time.

You'll find the newly installed Ruby at /Users/username/.rvm/gems/ruby-1.9.3-p484.

To switch to it:

$ rvm use ruby-1.9.3-p484

To check what Ruby you're using:

$ rvm use

Troubleshooting

If you're getting errors like this:

configure: error: C compiler cannot create executables
See `config.log' for more details
There has been an error while running configure. Halting the installation.

You might face this especially if you're using Mavericks.

Possible causes:

  • You don't have Xcode installed (go to the App Store and install it)
  • or you have an old version of it (go to App Store and upgrade it)
  • or you don't have the Xcode command line tools installed (go to the Xcode > Settings > Downloads and download the latest Command Line Tools)

If that won't help, go to Terminal and run:

$ xcode-select --install

More on this here and here.

Install Sass and Compass

Now that you got the proper Ruby version up and running you can install Sass and Compass, see the Sass gem page for the latest verion.

# This gets the latest pre release
# At the time of writing it's 3.3.0.rc.3
$ gem install sass --pre

When the stable 3.3 is out, you want to use it rather than the alpha. Just skip the --pre from it: gem install sass.

Get Compass alpha, see the Compass gem page for the latest version.

# This get the latest pre release
# At the time of writing it would be 1.0.0.alpha.18
$ gem install compass --pre

Trouble shooting

If you get errors, you might have an old Ruby version, see the Upgrade Ruby above.

Using different gemsets for different projects

What if you need the old Compass on some project? Cause the project uses Compass plugin that is not compatible with the new Compass version (or something). Fret not, you can use different gemsets for different projects. See RVM docs on it.

Make a new gemset:

$ rvm 1.9.3-head
$ rvm gemset create mygemset
Gemset 'mygemset' created.

Official RVM documentation.

Using a gemset

$ rvm ruby-1.9.2-p320@mygemset

To automatically define the right gemset per project basis, you just put a file called .rvmrc into the root of the project that has that command in it. An example .rvmrc file:

rvm use ruby-1.9.3-p484

See my followup post on how to enable sourcemaps in Sass and Compass.

Comments would go here, but the commenting system isn’t ready yet, sorry.

  • © 2022 Antti Hiljá
  • About
  • All rights reserved yadda yadda.
  • I can put just about anything here, no one reads the footer anyways.
  • I love u!