One of my primary tools used for programming is my Terminal. It makes my programming process more efficient when I'm able to quickly open a Terminal window. In Ubuntu, I was using ( window + Alt + T ) to open Terminal. But now I use a Macbook at my programming job. Sometimes I use Spotlight to search "Terminal", and press Enter. I'd like to know if I can assign a keyboard hotkey to do it.
34.7k 25 25 gold badges 167 167 silver badges 197 197 bronze badges asked Mar 12, 2016 at 5:33 Gopal Prasad Gopal Prasad 2,027 2 2 gold badges 13 13 silver badges 12 12 bronze badgesI'm voting to re-open this question because it falls under the "tools used primarily for programming". Programmers use the terminal primarily for running programming-related tasks.
Commented Oct 12, 2016 at 23:47@JonKiparsky The question is about having the Terminal open somewhere and opening a new window when another app has the focus.
Commented Apr 6, 2017 at 5:09Just because I think it's ridiculous. I'm reiterating what @GregKopff stated. "unless they directly involve tools used primarily for programming". Gopal Prasad, the OP, clearly says "One of my primary tools used for programming is my Terminal." Like come on.. a solution to this is highly valuable.
Commented Aug 26, 2017 at 22:02This is a perfectly valid question! There may be many people coming from Linux (using desktops such as Unity, XFCE, Cinnamon, MATE, etc.) looking for functionality like this. The upvotes prove the interest.
Commented Jan 11, 2019 at 0:16@Socrates I agree, but probably AskDifferent is the more ideal location for this question, and SO gets polluted/overused an awful lot. So I have some sympathy with why it was flagged.
Commented Feb 6, 2019 at 12:34I tested the following procedure under macOS Mojave 10.14.6 (18G3020).
Launch Automator. Create a document of type “Quick Action”:
(In older versions of macOS, use the “Service” template.)
In the new Automator document, add a “Run AppleScript” action. (You can type “run applescript” into the search field at the top of the action list to find it.) Here's the AppleScript to paste into the action:
on run tell application "Terminal" if it is running then do script "" end if activate end tell end run
Set the “Workflow receives” popup to “no input”. It should look like this overall:
Save the document with the name “New Terminal”. Then go to the Automator menu (or the app menu in any running application) and open the Services submenu. You should now see the “New Terminal” quick action:
If you click the “New Terminal” menu item, you'll get a dialog box:
Click OK to allow the action to run. You'll see this dialog once in each application that's frontmost when you use the action. In other words, the first time you use the action while Finder is frontmost, you'll see the dialog. And the first time you use the action while Safari is frontmost, you'll see the dialog. And so on.
After you click OK in the dialog, Terminal should open a new window.
To assign a keyboard shortcut to the quick action, choose the “Services Preferences…” item from the Services menu. (Or launch System Preferences, choose the Keyboard pane, then choose the Shortcuts tab, then choose Services from the left-hand list.) Scroll to the bottom of the right-hand list and find the New Terminal service. Click it and you should see an “Add Shortcut” button:
Click the button and press your preferred keyboard shortcut. Then, scratch your head, because (when I tried it) the Add Shortcut button reappears. But click the button again and you should see your shortcut:
Now you should be able to press your keyboard shortcut in most circumstances to get a new terminal window.