Tuesday, 18 March 2008

Holy grails on Mac OS X Leopard

In an earlier post I showed how to install "groovy", a "ruby" like language, that runs on top of the Java VM, it is the backbone of the Grails initiative which aims to provide a Rails like environment on the Java Platform, Groovy is to Grails, as Ruby is to Rails.

This time I'm going to show you how to install and setup Grails on leopard. If this post looks simular to the groovy post, then thats because the method for installing the two are very simular, and I have a cut and paste button, and imm feeling lazy.


First make sure you have java and its dev tools setup on your machine see this post on how to do that.

Now download grails from the grails site.

Unpack the archive and move it to /usr/share , for example:
$ sudo mv ~/downloads/grails-1.0.1 /usr/share 
Now set ownership and permissions on the directories
$cd /usr/share
$sudo chown -R root:wheel grails-1.0.1/
$sudo chmod 0755 grails-1.0.1/bin/*

Now create a symlink to access the current version of grails by, if you download and install another version later, you can just move the symlink to point at it, this is a good practice as it prevents you having to overwrite your old installation.
$ln -s grails-1.0.1 grails

Finaly add the following to your /etc/profile or ~/.profile depending on wether you want it available for all logons or just your own.
GRAILS_HOME=/usr/share/grails; export GRAILS_HOME
And the following to your path in the same file, note your path should be defined after the above
Now your ready to try it out and see if it works, open up a terminal and type:

Welcome to Grails 1.0.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails

No script name specified. Use 'grails help' for more info
Cool, it works.


Anonymous said...

The last one should be


(without the Spaces around =)
Otherwise I got an error message when opening a new terminal session.

peter said...

thanks dude. i've been trying for awhile to get this working. it doesn't help that i'm new to Mac OS. I had it mostly done, but your post got me over the top! BRAVO +5 (in CL terminology...)

dASKAS said...

Big Thanks!

ZR said...

thank you. your tutorials helped me install groovy and grails easily :)

John said...

Thanks! These instructions together with the Java and Groovy notes were really very helpful.

raoul schmidiger said...

Thanks a lot!

Travis Fields said...

Great blog, this got me through the Groovy and Grails install without a problem.. Thanks

Anonymous said...

gracias compañero!

instalado en snow leopard sin problemas.

Anonymous said...

I'm new to Mac and I don't see an etc folder.

Is it at the root of the drive?

How do I create a profile or .profile?

To create a syslink, you used $ln -s grails-1.0.1 grails. What if you want to edit it to point to a new version?

mcvmcv@xs4all.nl v said...
This comment has been removed by the author.
Ray said...

Thanks so much for taking the time and effort to post this (and the groovy one). Super clear and helpful.

Mark said...

Got so far fine, then when I try the symlink (for 1.3.5), I get-bash: -s: command not found. Tried $sudo ln -s grails-1.3.5 grails and get ln: grails: Permission denied. What am I doing wrong?

Anonymous said...

I followed your steps but when I edit the profile file with :
GRAILS_HOME=/usr/share/grails; export GRAILS_HOME

Then I try to run the grails command I keep getting: -bash: grails:command not found.

Did I do something wrong? Anyone has any ideas?

Anonymous said...


source the profile file and then try running grails

Dan said...

Thanks too! Worked immediately.

Andrés said...

If you don't find the .profile file here are some steps to find the .profile file in Mac osx lion

I struggled with this for long but it was nice to find the solution =) I just needed to create the file!

Raghav Manchanda said...

Thank you :-)

I spent close to 5 hours trying to install Grails, tried new techniques. Your post is amazing.

BTW , for creation of /etc :

1) Open a terminal prompt

2) Type sudo vi /etc/launchd.conf (note: this file might not yet exist)

Raghav Manchanda said...
This comment has been removed by the author.
Raghav Manchanda said...
This comment has been removed by the author.
Raghav Manchanda said...
This comment has been removed by the author.
mahasiswa teladan said...

hi...Im student from Informatics engineering nice article,
thanks for sharing :)