Installing CoffeeScript on Ubuntu or Debian
Last updated: Dec 20, 2011
Four ways to install CoffeeScript, from best to worst:
1. npm on Ubuntu 11.10 Oneiric or Debian sid
The latest coffee-script packages in Ubuntu and Debian are always a bit outdated (see the CoffeeScript change log). CoffeeScript still changes a lot, so I recommend using npm, like so:
1 2 |
|
(You can ignore npm’s warning about sudo being bad.)
And that’s all. :-) Run coffee
for an interactive shell (REPL), and coffee --help
for help.
2. npm on older Ubuntus
On older Ubuntus, we need to use a PPA to pull in a recent enough Node.js (>= 0.4) and npm:
1 2 3 4 5 6 7 |
|
I have tested this on 11.04 Natty, though it should work on 10.04 and 10.10 as well.
3. Packages
These are slightly outdated, but you can use them if you absolutely hate npm:
4. Manually
If all else fails:
Head to the Node.js download page and download the latest stable version. Assuming you are installing version 0.6.6, you can copy and paste this whole block into your shell:
1 2 3 4 5
wget http://nodejs.org/dist/v0.6.6/node-v0.6.6.tar.gz && tar xzvf node-v0.6.6.tar.gz && cd node-v0.6.6 && sudo apt-get install make g++ libssl-dev && # dependencies ./configure && make && ./node --version && sudo make install # install into /usr/local
Now let’s install CoffeeScript: Head to the CoffeeScript home page for the latest version. Assuming it’s 1.2.0, here’s a block to copy and paste:
1 2 3 4 5
wget -O- --no-check-certificate \ https://github.com/jashkenas/coffee-script/tarball/1.2.0 | tar xz && cd jashkenas-coffee-script-*/ && bin/cake test && bin/coffee --version && # test; no need to build sudo bin/cake install # install to /usr/local
Happy brewing!