Stephen’s blogs

Installing Groovy and Grails

Having just bought a new Mac Book I thought I would document the steps for installing Groovy and Grails.

Step 1 - Download Groovy

Go to download Groovy (Version 1.5.7). The Tutorial 1 - Getting Started is a help but as a newcomer to Mac OS-X I found the installation instructions more than a bit vague.

Download the zipped Binary Release and copy the resulting folder (mine was called groovy-1.5.7) to your target folder. I stored mine in the Library folder (under Macintosh HD). This is where the Java folder resides, so it seemed a reasonable place to store it.

Step 2 - Download Grails

While we are here, we might as well do the same for Grails via the download website and download the Binary ZIP. Move the resulting folder (grails-1.0.3) to the Library folder.

Step 3 - Edit HOME variable

The Getting Started instructions tell you to Create a GRAILS_HOME environment variable that points to the path where you extracted the archive. On the Apple this is in a file called profile which is found in the etc folder.

In the Textmate ‘open file’ dialog box (tick the Show Hidden Files checkbox) and edit /etc/profile to include the following:

export JAVA_HOME=/Library/Java/Home
export GROOVY_HOME=/Library/groovy-1.5.7
export GRAILS_HOME=/Library/grails-1.0.3

Step 4 - Check it out

By opening the terminal window (Applications/Utilities/Terminal) and typing groovysh you can check that Groovy was installed properly.

Then type grails to check that grails is installed. This gave me a -bash: /Library/grails-1.0.3/bin/grails: Permission denied error. Run the command chmod +x /Library/grails-1.0.3/bin/grails - to fix this problem (I am not sure what this does but I found the solution somewhere on the web).

Have fun!

<<  back