Setting Up CoffeeScript in CodeRunner
The nifty Mac app CodeRunner lets you edit and run code written in a variety of programming languages in a window. It comes pre-installed with the most likely programming candidates – AppleScript, C, Perl, Ruby, etc – and allows you to add others fairly easily. Just pick your language, write your code, and run.
My pal John asked for a little help getting the app working with CoffeeScript ((Yes, when John August isn’t busy writing awesome movies and/or writing Broadway shows and/or podcasting and/or managing several on-going software products, he’s writing code in CoffeeScript. Math-y code, no less.)), and since this process doesn’t seem Google-able at the moment, I figured I’d give a little back to the Interwebs by detailing it here:
To set up CoffeeScript with CodeRunner you need to install Node.js, npm (node package manager), and the CoffeeScript command line tool on your machine, then add CoffeeScript to CodeRunner’s configuration.
1. Install Node.js and npm
You can install both Node.js and npm at the same time via the Mac installer available at http://nodejs.org. At the time of this writing, the direct link to the latest Mac installer is here. Just download, run, and you’re good.
2. Install CoffeeScript
After you have installed npm open Terminal and run the command
sudo npm install -g coffee-script. It will ask you for your password, and then install the command line CoffeeScript tool onto your system.
3. Configure CodeRunner
In CodeRunner, open the Preferences and add a new language to the list of available programming languages (you should probably name it CoffeeScript). Under Run Command write
coffee $filename, set the Syntax Mode to
coffee. For the visual learners out there, here is a screenshot of what that should all look like:
That’s it. You should now be able to run CoffeeScript in CodeRunner. You can add other languages in a similar manner – install the command line version of the language processor and configure the app to use it.