1

Target

Run a command line tool or script displayed with a specific icon in dock. A terminal window should not be displayed. I would like to use this to start octave with its gui.

What I tried

  • Automator
    1. Create an automator application and running a shell script.
    2. Change its icon using finders file information window
    3. I now have an individual application icon
    • Result: After start, automator calls terminal and terminal icon appears in dock hosting my command line tool. My indiviual icon is not showing up in dock while running.
  • Shell script
    1. Create a shell script myapp.sh starting my command line tool.
    2. Make executable with chmod u+x myapp.sh
    3. Can not change icon at all using finders information window.
    • Result: When clicking a terminal window is opened.

Possible solutions

  • Use a command line tool to change the icon of the currently running process?
  • Start terminal with a specific icon?
  • ...?
1
  • Probably more stable to just create a small application that performs the shell script.
    – red_menace
    Feb 19 at 20:46

1 Answer 1

1

First locate your octave-gui Unix Executable file. This is the path my version is located.

/usr/local/Cellar/octave/7.3.0_3/libexec/octave/7.3.0/exec/x86_64-apple-darwin22.1.0/octave-gui

Then in Finder, go ahead and change its icon in the Get Info window.

Next, create a new Script Editor.app document and paste this following AppleScript code.

do shell script "/usr/local/bin/octave --gui"

(I installed Octave using Homebrew in Terminal.app. After it was installed, to retrieve it's full path to use in the above AppleScript code, in Terminal, the command which octave... Returned its full path.)

Next, save your new Script Editor document as an application. (I saved my version as Launch_Octave.app)

Now, anytime you run the Launch_Octave.app, both the Launch_Octave.app and octave-gui with its custom icon will appear in the Dock.

However, you can hide the Launch_Octave.app from appearing in the Dock, so you can only see octave-gui with its custom icon appearing in the Dock by adding these two following lines to the Info.plist file within the Contents folder inside the Launch_Octave.app package. (Right click Launch_Octave.app in Finder and choose "Show Package Contents")

<key>LSUIElement</key>
<true/>

As you can see in this following animation, I am double clicking on the Launch_Octave.app located on my Desktop (which launches the octave-gui with its custom icon, which appears in the Dock while Launch_Octave.app does not appear in the Dock.

You must log in to answer this question.

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