Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

macos

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?

like image 442
user66237 Avatar asked May 01 '09 22:05

user66237


People also ask

How do I run a script on Mac?

In the Script Editor app on your Mac, click the Run button in the toolbar, or press Command-R, to execute the commands in your script.


3 Answers

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.

like image 118
pgb Avatar answered Oct 13 '22 03:10

pgb


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.

like image 25
JW. Avatar answered Oct 13 '22 04:10

JW.


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.

like image 35
Samir Talwar Avatar answered Oct 13 '22 03:10

Samir Talwar