How do I tell IntelliJ about groovy installed with brew on OSX

David picture David · Dec 12, 2016 · Viewed 27.4k times · Source

I'm running:

  • IntelliJ Ultimate 2016.3
  • Homebrew 1.1.2
  • OS X 10.11.5 El Capitan

I ran brew install groovy which resulted in groovy being installed in /usr/local/Cellar/groovy/2.4.7/. Brew also added a symlink: /usr/local/bin/groovy -> ../Cellar/groovy/2.4.7/bin/groovy

When I open the groovy project in IntelliJ, it gives me an option to Configure a Groovy SDK. I haven't set this up yet, so I get a "Create" button, which launches finder. From what I can tell there's nothing that I can select to make IntelliJ happy. I've tried /user/local/bin/groovy, /user/local/Cellar/groovy, /user/local/Cellar/groovy/2.4.7, /user/local/Cellar/groovy/2.4.7/bin etc. No mater which I choose, IntelliJ doesn't accept the library and continues to tell me "Error: library is not specified".

Does anyone know how I'm supposed to go about telling IntelliJ where groovy is?

Answer

Omer van Kloeten picture Omer van Kloeten · Mar 22, 2017
  1. Install groovysdk:

    brew remove groovy 
    brew install groovysdk

  2. Set GROOVY_HOME, otherwise Intellij reports as broken installation:

    export GROOVY_HOME=/usr/local/opt/groovy/libexec

  3. Point IntelliJ to the installed directory, e.g.:

    /usr/local/Cellar/groovysdk/2.4.7/libexec