Groovy is the new "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 post will show you how to setup groovy on Leopard, and allow you to explore this intriguing new language.
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 groovy from the groovy site.
Unpack the archive and move it to /usr/share , for example:
$ sudo mv ~/downloads/groovy-1.5.4 /usr/share
Now set ownership and permissions on the directories
$cd /usr/shareNow create a symlink to access the current version of groovy 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.
$sudo chown -R root:wheel groovy-1.5.4/
$sudo chmod 0755 groovy-1.5.4/bin/*
$sudo ln -s groovy-1.5.4 groovyFinaly add the following to your /etc/profile or ~/.profile depending on wether you want it available for all logons or just your own.
GROOVY_HOME=/usr/share/groovy; export GROOVY_HOME
And the following to your path in the same file, note your path should be defined after the above
PATH=$GROOVY_HOME/bin:$PATH; export PATH
Now your ready to try it out and see if it works, open up a terminal and type:
$groovyConsole
The groovy console window should open up as shown above, thats it your done, stay tuned for more groovy news.
15 comments:
Thanks, your install instructions worked great for me.
Just 2 changes:
I needed sudo before $ln -s groovy-1.5.4 groovy
Path statement has spaces around the =
It should be:
PATH=$GROOVY_HOME/bin:$PATH; export PATH
Thanks a lot, very helpful. :)
Michal Huniewicz
This was just what I was looking for. Thanks for the great instructions for Groovy and also Java. Now on to Grails!
Thanks Tim. This helped a lot. I hate configuring PATH variables.
One note to the less command line l337 like myself: to test the Groovy Console type "groovyConsole" instead of "$groovyConsole". The dollar sign represents the command prompt again. I got confused after typing the PATH variables.
Just wanted to say thank you. This worked for me exactly as written (although I did change the install directory and used groovy 1.6. Thank you for taking the time to write this!
-Grant Gortsema
Installed 1.6.4 worked like charm
thanks
BTW i used ~/.bash_profile instead of whatever ...
thanks again
Thanks! Worked fine for 1.7.1 on snow leopard.
Working Great on Snow Leopard 10.6.4 MBP
Helpful for a script-er going to java! :)
Thanks!
On the Mac -unless you want to install version 1.7- it's easier to use Ports:
$ sudo port install groovy
Same story with Grails.
Thanks very much! That was much faster than downloading XCode, required to install MacPorts... Happy New Year!
Awesome....Thank you very much!
Thanks for the info. I installed 1.8.5 and it worked great. I learned a little about the Unix command line too
Just wanted to say thanks for this post. I've referred to it multiple times over the past week for various installations (not just Groovy). Very helpful... Thanks!
Thanks for the straightforward and comprehensive instructions (especially the direction to put it in /usr/share - I never seem to work out the best place to put these packages).
Post a Comment