Installing Groovy on Linux and OS X

This recipe gives you instructions for installing Groovy on any Linux distribution and Mac OS X.

How to do it...

As a starter, download the Groovy 2.0 binaries as described in the Installing Groovy on Windows recipe and perform the following steps to install Groovy on Linux and OS X:

  1. Create a new folder for the Groovy distribution:
    sudo mkdir /usr/share/groovy
    
  2. Move the unzipped Groovy folder into /usr/share/groovy and create a symlink to the folder, without using the version number:
    sudo mv groovy-2.1.6 /usr/share/groovy/
    sudo ln -s /usr/share/groovy/groovy-2.1.6 current
    
  3. Finally, add Groovy to the path by editing your ~/.profile (or ~/.bash_profile) file. You can use vi or an editor of your choice:
    export GROOVY_HOME=/usr/share/groovy/current ...

Get Groovy 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.