How can I install and run Groovy console/IDE from the dock on Mac Sierra?

  • Try asking on the apple forum here: apple.stackexchange.com – HackSlash Mar 2 '18 at 20:55
  • 1
    Does that 'best solution' work for you? If so you should post it as an answer, and not as part of the question :) – bertieb Mar 3 '18 at 11:16
  • @bertieb answer converted to community wiki – Twisty Impersonator Mar 17 '18 at 16:00
  • Can I have a link to that wiki @ – wick Mar 17 '18 at 16:05
  1. Follow these instructions http://sdkman.io/install.html and make sure you restart your terminal session after each step;

  2. Say $ sdk install groovy to install groovy (I assume you have jdk already installed);

  3. Start your Groovy Console in terminal

    $ ~/.sdkman/candidates/groovy/current/bin/groovyConsole

    It runs as a separate process;

  4. Say $ ps aux |grep groovy - you will find out that the console is run as

    /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/bin/java -Xdock:name=GroovyConsole -Xdock:icon=/Users/yourname/.sdkman/candidates/groovy/current/lib/groovy.icns -classpath /Users/yourname/.sdkman/candidates/groovy/current/lib/groovy-2.4.14.jar -Dscript.name=/Users/yourname/.sdkman/candidates/groovy/current/bin/groovyConsole -Dprogram.name=groovyConsole -Dgroovy.starter.conf=/Users/yourname/.sdkman/candidates/groovy/current/conf/groovy-starter.conf -Dgroovy.home=/Users/yourname/.sdkman/candidates/groovy/current -Dtools.jar=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/lib/tools.jar org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.Console --conf /Users/yourname/.sdkman/candidates/groovy/current/conf/groovy-starter.conf --classpath .

    I will refer that mess as jvm-verylongline

  5. Exit the console and start automator.app, choose Application and double-click Run Shell Script action;

  6. Save it as groovyConsole.app to your home folder and exit automator;

  7. Edit ~/groovyConsole.app/Contents/Info.plist and change 3 lines:

  8. Create file ~/groovyConsole.app/Contents/MacOS/fuckmac and make it read:

    exec -c jvm-verylongline

    Replacing jvm-verylongline as per above, obviously;

  9. Say $ chmod +x ~/groovyConsole.app/Contents/MacOS/fuckmac

  10. As the icon is conveniently named in the jvm-verylongline, do

    $ cp /Users/yourname/.sdkman/candidates/groovy/current/lib/groovy.icns ~/groovyConsole.app/Contents/Resources/
  11. Now you should be able to run the app by double-clicking it in Finder, but probably still with the wrong icon due to caching;

  12. Drag-and-drop the app from your home folder to Applications in Finder - this is when the icon malarkey gets fixed;

  13. Now you can also drag-and-drop to dock the app.

Note: This solution was originally posted by the OP as an edit to the question

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.