user66237
user66237

Reputation: 813

How can I launch a script from the MacOS X dock?

I know that I can pin applications to the dock and launch them from there. However, is there a way to pin a program to the dock that is not an "application" in the MacOS sense, like a bash script for example?

Upvotes: 11

Views: 8232

Answers (4)

AmbroseChapel
AmbroseChapel

Reputation: 12097

There are also tools to make applications from shell scripts, perl, python etc. There's DropScript and Platypus that I know of. They have the advantage that you can drag and drop files onto them.

Upvotes: 3

JW.
JW.

Reputation: 51668

Rename it to something.command, and in its Get Info window, select Open With > Terminal.app. Then when you double-click it, it will launch the Terminal and run the script. You can drag that to the dock.

Upvotes: 4

Samir Talwar
Samir Talwar

Reputation: 14330

The Script Editor can create applications based on AppleScript. Stick the following code into a script and save it as an application:

do shell script "~/someScript.sh"

Where ~/someScript.sh is the path to your shell script.

Upvotes: 3

pgb
pgb

Reputation: 25011

You can drag any file to the right bar of the Dock (where the Trash and folders are), and execute it by clicking it.

To execute a shell script, you can save it as a .command file and the OS will pick it up.

Another alternative would be to create an Applescript application for your script, and use it like any application.

Upvotes: 9

Related Questions