Skip to content

Instantly share code, notes, and snippets.

@Geraint
Last active Sep 29, 2017
Embed
What would you like to do?
Installing SASS/Compass on Windows via Cygwin

Install Cygwin & Ruby

Follow the instructions at http://cygwin.com/install.html. You will run an executable called setup.exe which will guide you through the installation. You will eventually arrive at a screen where you can select the packages you want to install. Be sure to install Ruby (its under Interpreters/ruby).

Once Cygwin has finished installing packages, it will offer to create icons for you. You can click on these icons to start up a terminal session, so select what ever is convenient for you.

Once installation is complete, start a terminal session.

Confirm that ruby is installed by typing this at the prompt:

ruby -v

You should see something like this come back:

ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]

Install RubyGems

A lot of Ruby software, including SASS and Compass, are distributed using the package manager "RubyGems". You need to install RubyGems. The instructions at http://old.stevenharman.net/blog/archive/2008/11/12/installing-rubygems-in-cygwin.aspx have worked for me.

Once you have followed those instructions, confirm that RubyGems is installed by typing this at the prompt.

gem -v

You should see something like this come back:

1.7.2

(I also get a cygwin warning, complaining that an MS-DOS style path has been detected - I have ignored this up to now with no apparent ill effects).

Install SASS/Compass

To install just SASS:

gem install sass

To install SASS and Compass:

gem install compass

Having reached this point, it should be plain sailing. You can follow the SASS Tutorial at http://sass-lang.com/tutorial.html and/or the Compass Installation guide at http://compass-style.org/install/.

One last gotcha

We're almost there now. There's one last gotcha, which causes the compass watcher to crash when you change a file. For a fix, see this comment on StackOverflow: http://stackoverflow.com/a/6552159/109282

Cygwin Style Paths

Note: it's worth being aware of Cygwin style paths, and how they differ from Windows style paths. Basically, a Windows path like this:

C:\Users\bob\project1\

... maps to a Cygwin path like this:

/cygdrive/c/Users/bob/project1/

There's more info at http://cygwin.com/cygwin-ug-net/using.html#cygdrive.

@oscarislasleyva
Copy link

today, I try to install the compass gem, but mkmf.log says

package configuration for libffi is not found
"gcc -o conftest.exe -I/usr/include/ruby-2.2.0 -I/usr/include/ruby-2.2.0/ruby/backward -I/usr/include/ruby-2.2.0 -I. -ggdb -O2 -pipe -Wimplicit-function-declaration conftest.c -L. -L/usr/lib -L. -fstack-protector -lruby220 -lpthread -lgmp -ldl -lcrypt "
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: no se puede encontrar -lgmp
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: no se puede encontrar -lcrypt
collect2: error: ld devolvió el estado de salida 1
checked program was:
/* begin _/
1: #include "ruby.h"
2:
3: int main(int argc, char *_argv)
4: {
5: return 0;
6: }
/* end */

I have cygwin 64bit

@ianlater
Copy link

I experienced the same problem as oscar. package config for libffi is not found, can't find -lgmp. I have found libffi and tried installing libffi-dev in cygwin to no change

@passani
Copy link

passani commented Jan 11, 2017

Not so smooth here:

$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-cygwin]

$ gem install sass
Fetching: sass-3.4.23.gem (100%)
Successfully installed sass-3.4.23
Parsing documentation for sass-3.4.23
Installing ri documentation for sass-3.4.23
Done installing documentation for sass after 19 seconds
1 gem installed

$ sass
-bash: sass: command not found

where does sass get installed?

@rsau
Copy link

rsau commented Sep 29, 2017

You probably found the solution.
This is for anyone who lands here from search engine.

check ~/.gem/ruby/2.3.0/gems/sass-3.5.1/bin

Change version numbers reflecting your installation.

or for any other gem

gem which gem_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment