Installing Groovy on OSX

I’m a big fan of Ruby, and love using its enumerators and syntax to make my life easier. I’m also starting a new gig where the company is using Grails as a major part of their stack. So, I’m enthusiastic about getting into Groovy and sharing my experience.

Getting Groovy

  • Download it from here. Get the zipped up binary (currently about 27M).

Installation

  • First reveal it in Finder and copy to /opt. You can open two Finder windows and use command-shift-g to open /opt. Then drag and drop.
  • Depending on your permissions, /opt may only be write accessible by root. If so, use sudo unzip from the command line.
  • It’s nice to have a directory just named ‘groovy’ instead of ‘groovy-[version]’. Do yourself a favor and make a symlink for switching versions easily later: sudo ln -s groovy-[version] groovy.
  • Fix permissions in the ‘bin’ directory: chmod a+x *
  • Put Groovy environment variables and such in your ‘.bashrc’, ‘.profile’, ‘.zshrc’, or whatever you use:
.zshrc
1
2
3
4
### Groovy
GROOVY_HOME=/opt/groovy
PATH=$PATH:$GROOVY_HOME/bin
export GROOVY_HOME PATH
  • Source your changes: source ~/.zshrc
  • Make sure everything is groovy: groovy -version

Comments