Download the latest versions of Groovy & Grails. Currently that is groovy-binary-2.0.1.zip and grails-2.1.0.zip. Let’s unzip these archives into /usr/share;
cd /usr/share
sudo unzip ~/Downloads/groovy-binary-2.0.1.zip
sudo unzip ~/Downloads/grails-2.1.0.zip
Next we setup environments variables, which points to these paths. Adding these to our .bash_profile, makes our system environment read it.
cat << EOF >> ~/.bash_profile
# Java, Groovy & Grails
export GROOVY_HOME="/usr/share/groovy-2.0.1"
export GRAILS_HOME="/usr/share/grails-2.1.0"
export JAVA_HOME="/Library/Java/Home"
export PATH="\$PATH:\$GROOVY_HOME/bin:\$GRAILS_HOME/bin:\$JAVA_HOME/bin"
EOF
Open a terminal a type grails -version
to verify.