Grails is an excellent rapid application development framework that integrates well with many industrial-strength analytics products.
Here’s how to install Grails 1.3.7 on Mac OS X 10.6 Snow Leopard. It should also work on earlier versions of Grails and OS X. I will note that Grails.org does provide instructions, but I prefer these.
Install Java SDK
Before you install Grails, make sure you have a Java SDK 1.5+ installed. The Java runtime that comes preinstalled with OS X does not have the SDK.
Download Grails
Download Grails from grails.org.
Install Grails
Unpack the archive you downloaded. It’ll be a folder.
Move the folder to /usr/share/java. I just used Finder, but here’s the obligatory Terminal command:
$ sudo mv ~/downloads/grails-1.3.7/usr/share/java
Note: some people install it to /usr/share/, but these instructions install it to /usr/share/java because that’s where other Java tools like Maven, Ant, JUnit and Derby are installed. Grails’ official instructions suggest your home directory (~/grails), which is just plain weird.
Change ownership and permissions:
$cd /usr/share/java $sudo chown -R root:wheel grails-1.3.7/ $sudo chmod 0755 grails-1.3.7/bin/*
Create a symlink that allows you to access Grails without referencing the version number. This way, to upgrade your Grails you just install the newer version alongside the old one, and update this symlink. This is a standard best practice.
$sudo ln -s grails-1.3.7 grails
To make Grails available, add the following either to /etc/profile (for everyone) or ~/.profile (for just you):
export GRAILS_HOME=/usr/share/java/grails export PATH=$GRAILS_HOME/bin:$PATH
If you haven’t set the JAVA_HOME environment variable yet, create one in .profile that points to the path where you have installed Java. It’ll be something like this.
export JAVA_HOME=/Library/Java/Home
Let’s see if it works. Open Terminal and type:
$grails
You should see:
Welcome to Grails 1.3.7 - http://grails.org/ Licensed under Apache Standard License 2.0 Grails home is set to: /usr/share/java/grails No script name specified. Use 'grails help' for more info or 'grails interactive' to enter interactive mode
Happy Grailing!
Pingback: grailstutorial.org()