Prerequisites
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
PATH = $GRAILS_HOME/bin:$PATH; export PATH
Now your ready to try it out and see if it works, open up a terminal and type:
$grails
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.
20 comments:
The last one should be
PATH=$GRAILS_HOME/bin:$PATH; export PATH
(without the Spaces around =)
Otherwise I got an error message when opening a new terminal session.
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...)
Big Thanks!
thank you. your tutorials helped me install groovy and grails easily :)
Thanks! These instructions together with the Java and Groovy notes were really very helpful.
Thanks a lot!
Great blog, this got me through the Groovy and Grails install without a problem.. Thanks
gracias compañero!
instalado en snow leopard sin problemas.
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?
Thanks so much for taking the time and effort to post this (and the groovy one). Super clear and helpful.
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?
I followed your steps but when I edit the profile file with :
GRAILS_HOME=/usr/share/grails; export GRAILS_HOME
PATH=$GRAILS_HOME/bin:$PATH; export PATH
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
source the profile file and then try running grails
Thanks too! Worked immediately.
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!
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)
Post a Comment