Search code examples
rubyrubygemssass

How do I run a Ruby Gem?


This might seem stupid, but I recently tried to install SASS and followed their instructions:

$ gem install sass 
$ sass --watch [...]

So I followed along:

root@server:~# gem install sass
Successfully installed sass-3.1.15
1 gem installed
Installing ri documentation for sass-3.1.15...
Installing RDoc documentation for sass-3.1.15...

root@server:~# sass
bash: sass: command not found

Despite looking around like an idiot trying to find some simple way to run something like gem run sass or some other workaround to make it function, I am more or less at a loss.


Solution

  • It seems that Debian/Ubuntu drops ruby gems into /var/lib/gems/1.8/bin.

    So the solution (at least for Ubuntu/Debian) is:

    $ sudo -s
    # echo 'PATH=/var/lib/gems/1.8/bin:$PATH' > /etc/profile.d/gemspath.sh
    # chmod 0755 /etc/profile.d/gemspath.sh
    

    ...and then open a new shell session.

    (This is fixed in Ubuntu 11.10.)