0

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

4
  • Try asking on the apple forum here: apple.stackexchange.com
    – HackSlash
    Mar 2, 2018 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, 2018 at 11:16
  • @bertieb answer converted to community wiki Mar 17, 2018 at 16:00
  • Can I have a link to that wiki @
    – wick
    Mar 17, 2018 at 16:05

1 Answer 1

1
  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:

    <key>CFBundleExecutable</key>
    <string>fuckmac</string>
    <key>CFBundleIconFile</key>
    <string>groovy</string>
    <key>CFBundleIdentifier</key>
    <string>com.apple.groovyConsole</string>
    
  8. Create file ~/groovyConsole.app/Contents/MacOS/fuckmac and make it read:

    #!/bin/bash
    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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .