Compiling Processing sketches from the Command Line and TextMate

If you’re running Processing 2 β5 or later, you can install a command-line app which will compile and run your sketches for you. It’s called processing-java. To install it, open Processing and select “Install processing-java” from the “Tools” menu.

Once that was installed, I added the following line to ~/.profile that allows me to quickly launch a Processing app from the CLI:

 

alias run_sketch="processing-java --sketch=\"\`pwd\`\" --output=/tmp/processing_output --force --run"

 

When you’re in a sketch directory, you can simply type `run_sketch` to compile and launch the program.

I’ve also downloaded the TextMate Processing Bundle, which adds some Processing text-completion and shortcuts to TextMate. Once that’s installed, I remapped ⌘R to the following command, which runs the sketch with processing-java.

 

#!/usr/bin/env bash
/usr/bin/processing-java --sketch="$TM_PROJECT_DIRECTORY" --output=/tmp/processing_output --force --run

 

Voila! You can now edit and run your Processing sketches without the Processing IDE, if you’re so inclined.

Leave a Comment

Tags: , ,

February 20, 2013 Uncategorized