There is one caveat to using shell scripts in Automator, which is you will notice that the Terminal window does not remain open. This will create an app with your chosen name that will execute the Terminal commands that you entered. Once you have finished entering the commands, click file > save and save the automation to your prefered location. Note that it is possible to enter multiple commands here in the same way that you might write a bash script.įor this example we can add a shortcut to open the Siytek homepage: Now we can add the Terminal command or a series of Terminal commands, which we would like to launch when clicking our shortcut. You can use the search box to locate it quicker if you prefer. Add a new actionįrom the left-hand sidebar select library and then select run shell script. Go ahead and select Application and then click choose. When Automator opens you will be greeted with menu that allows you to select the type of document that you wish to create. Navigate to the Applications folder and double click the Automator application. We will use it to turn a shell script into an application that we can load on boot. You may not know this already but you have a really cool little program called Automator that comes built into the Mac OS operating system.Īs the name suggests, it can be used to automate many different tasks. How To Save A MacOS Terminal Command as a Shortcut Using Automator It is also possible to use the Automator program, which gives you more flexibility when creating shortcuts. Using a text editor is not the only way to create a shortcut using Terminal commands. That’s it! Now when you double-click the file, it will execute the commands in the script. Once we have created the shortcut, we need to make it executable with the following command. Once you have entered the desired Terminal commands, go ahead and save the file and exit by pressing control + X and then typing Y. In this example we will create a shortcut that opens the Siytek website in our default browser. Next we should add our desired commands to the shortcut in the form of a short shell script. In this example we will place it on the desktop.Įnter the following command into terminal in order to create a new file called myshortcut on the desktop and open it with Nano text editor. Next we will create a new file that will become our Terminal command shortcut. However you can also put a shortcut on the dock or use launchpad. I find the quickest way to open a new Terminal window is just to type terminal into spotlight. There is even several text editors built into the Terminal that you can already use! 1. How To Save A MacOS Terminal Command as a Shortcut Using a Text EditorĪ very quick and simple way to create a shortcut to a Terminal command is by using a text editor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |