// 02.Dec.2009

Installing LESS on OS X

I’ve just started experimenting with LESS for a new web development project. With my programmer head on, LESS looks like it has the potential to speed up my CSS coding (which I do by hand) as well as enabling me to abstract my CSS with variables (very handy), nested rules, mixins and even mathematical operations (yeah baby)!

However, installing LESS on my OS X “Leopard” machine wasn’t quite as simple as advertised. I should just be able to go:

sudo gem install less

But that resulted in an error:

ERROR: While executing gem ... (Gem::RemoteSourceException)
HTTP Response 403 fetching http://gems.rubyforge.org/yaml

I ended up scratching my head for a moment — before turning to my good friend and problem-solving guru, Google, for help. I was advised as follows:

wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
tar xzf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo ruby setup.rb
sudo gem update --system
sudo gem install less

That worked a treat.

Then, in Terminal, I navigated to my source directory, renamed my style.css file to style.less and issued the following command:

lessc style.less --watch

LESS then generated a new style.css from my .less file and went into watching mode — automatically compiling my .less file into its .css counterpart whenever it detected changes in my source (ie: when I hit save in my text editor) which is a rather cool.

It’s early days yet, but so far LESS is looking like a tool that I can really make use of. I don’t need to change my workflow (aside from starting the watch/compiler process) and I get a degree of CSS flexibility and freedom that I didn’t have before. That’s neat.

Last Revision: December 2nd, 2009 at 05:46

2 Comments for “Installing LESS on OS X”

  1. Now there’s a GUI for the LESS compiler too: http://incident57.com/less/

  2. […] quick search sent me to Jonathan Hollin, who had experienced a similar problem, and discovered this […]