How to install Groovy on OS X

Setup Groovy with OS X 10.9.2 Mavericks using brew.

brew install groovy
echo "export GROOVY_HOME=/usr/local/opt/groovy/libexec" | tee -a ~/.bash_profile; source ~/.bash_profile

Here is a little test script taken from Groovy’s quickstart guide.

//hello.groovy
println "hello, world"
for (arg in this.args ) {
    println "Argument:" + arg;
}
// this is a comment
/* a block comment, commenting out an alternative to above:
this.args.each{ arg -> println "hello, ${arg}"}
*/

Save that has hello.groovy and run it with the following command:

groovy hello.groovy MyName yourName HisName

You should have the following apps installed:

  • groovy
  • groovyConsole
  • groovyc
  • groovydoc
  • groovysh
Apr 15, 2014 Programming

Support this blog

Buy yourself ANYTHING!

That's right! Shop as you normally would using Amazon.com with my affiliate link and the commissions made go directly into keeping this blog healthy. It's that simple! The hardware and software costs used for this site comes out of my own pocket and it's expensive. Lets keep this site ad free :)

Start shopping on Amazon.com now!

Thank you!
Richard S.