I have recently moved from Windows 11 to MacOS 14.0.
In Windows 11, I had several scripts written in PowerShell or Python. For each script, a shortcut was created, an icon assigned, then the shortcut was pinned to the start menu for quick access.
It took me a while to figure out similar ways in Mac.
In Mac OS, Finder is similar to Windows Explorer. Launchpad is similar to the Windows Start menu. Finder -> Favorites -> Applications or Launchpad will show all applications installed on Mac.
A script, by default, isn’t an application. So my initial thought was how to make a script an application, which leads following methods:
Shortcuts
Search shortcuts under Launchpad
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image.png)
Create new shortcut
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-1-1024x258.png)
Select Run Shell Script and enter the command to run shell script
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-2-1024x472.png)
Once the shortcut is created, right-click on it and choose Add to dock. Note you can also change the icon as well.
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-3.png)
The problem is that you won’t be able to see the output of the shortcut, so you don’t know the result.
Script Editor
In Launchpad, search for Script Editor
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-4.png)
Wrap the command to launch your script within do shell script “” block. Note you are creating an AppleScript
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-5-1024x186.png)
When you run it in the Script Editor. the output will be shown in the Result section.
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-6-1024x459.png)
You can export the script as an application
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-7-1024x652.png)
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-8.png)
In Launchpad, find the application, and run it
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-9.png)
However, the problem is the same as shortcuts, there is no output if running as an application.
Automator
In Launchpad, find Automator
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-10.png)
Choose application
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-11-1024x909.png)
Add following blocks sequentially:
- Run Shell Script
- View Results
- Set Value of Variable -> New Variable -> enter ‘output’
- Ask for confirmation -> In the Message field start typing out, and it will list all variables match out*, and hit enter before completing typing the whole word. This will make sure the message field uses the ‘output’ variable instead of the literal word ‘output’
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-12-1024x568.png)
After you run your script, you will notice View Results will have the output from our script. As well as a popup window (from Ask for confirmation) displays the result.
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-13-1024x548.png)
Now you can save the file in Application folder, and you should be able to find the application under Launchpad
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-14.png)
You may notice a little gear icon show up on your top menu bar, indicating the script is running
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-15.png)
After the script is completed, the Ask for Confirmation task will have this popup screen.
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-16-895x1024.png)
This is very close to what I wanted, but still have problems.
- Automator seems to be very heavy on resources and runs quite a lot slower than the actual script.
- You won’t be able to see the result on the fly, only till end of the execution.
- If you have pages and pages of output, the message screen doesn’t provide a scroll bar.
.command file extension
Finally figured out what’s the most elegant way to complete this simple task.
In Mac OS, when you create a file as a .command extension, this file is similar to a Windows batch file.
Create your .command file and use chmod +x to make sure it’s executable
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-17.png)
Populate your .command file
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-18-1024x86.png)
Test run in terminal
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-19-1024x141.png)
In Finder, find the .command file and drag and drop it to the right of the separator close to the trash bin.
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-20-1024x556.png)
Now you can click on the icon from the dock, it will launch the terminal and execute the shell commands. Perfect
![](https://cloudlearning365.com/wp-content/uploads/2023/10/image-21-1024x454.png)
You may also want to change the icon of the .command file to something better suit your script:
https://support.apple.com/en-ca/guide/mac-help/mchlp2313/mac