Mac – Run x11 app from dock

dockhomebrewmacports

I have an app in /usr/local/bin directory and can not drag it onto the dock and have to open Terminal everytime I want to run this program.

Is it possible to run a macported/homebrewed application from the Dock?

Best Answer

You should be able to do this using AppleScript, saving the script you create as an application, then dragging it to the dock.

For example, if you start the Apple Script Editor (/Applications/Utilities/Apple Script Editor.app). Then type something like the following, replacing my trivial example of /bin/date with the command you want to run

tell application "Terminal"
    do script "/bin/date"
 end tell

or

do shell script "/bin/date"

Either script should work, but the first explicitly opens the Terminal - it just depends on the application you want to run and whether it sticks around.

Then save this script as an application (use the dropdown in the save dialog to change the "File Format" to "Application").

enter image description here

You should then be able to drag the .app file you created to the Dock and run it.