24

I am using Alfred and hence I don't have any use for the Cmd+Space keyboard shortcut. I want to invoke terminal using that shortcut. Just like in Ubuntu, when you press Ctrl+Alt+T

I don't want to use Alfred to start the terminal. I just want to press Cmd+Space and I want the terminal to appear just like it would in Ubuntu.

Is there a way to start terminal like that in OS X Mavericks?

10 Answers 10

18

Keyboard Maestro

You can do this with Keyboard Maestro, using a macro such as this:

Alfred

You can set up a custom hotkey to launch an app using a workflow:

Go to the workflows tab, create a new workflow and add a hotkey and a 'launch apps' with Terminal selected as the app to launch.

KeyRemap4MacBook

You can use KeyRemap4MacBook with a private.xml such as this:

<?xml version="1.0"?>
<root>
  <vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_Terminal</name>
    <url>file:///Applications/Utilities/Terminal.app</url>
  </vkopenurldef>
  <item>
    <name>Activate Terminal with ⌘Space</name>
    <identifier>ActivateTerminalWithCmdSpace</identifier>
    <autogen>
      __KeyToKey__
      KeyCode::SPACE, VK_COMMAND | ModifierFlag::NONE,
      KeyCode::VK_OPEN_URL_Terminal
    </autogen>
  </item>
</root>

Automator Service

You can create a service in Automator:

Open Terminal

…then in System Preferences → Keyboard → Shortcuts → Services you can assign a keyboard command to run it.

7
  • 1
    Can't it be done natively like in Windows and Linux? I am asking because KeyBoard Maestro and alfred are not free.
    – Morpheus
    Feb 8, 2014 at 11:13
  • @Morpheus Added a method using KeyRemap4MacBook which is free
    – grg
    Feb 8, 2014 at 11:20
  • should keyremapformacbook be open all the time for this to run?
    – Morpheus
    Feb 8, 2014 at 11:26
  • @Morpheus The app doesn't need to be open — it adds a daemon.
    – grg
    Feb 8, 2014 at 11:27
  • 2
    @grgaside, automator is not working but keyremap is working. SO thanks!
    – Morpheus
    Feb 8, 2014 at 12:03
10

I was able to achieve the same behavior as Ubuntu Ctrl+Alt+T by combining following two steps:

  1. Set up an Automator service to open iTerm2: Open Automator app, select "Quick Action" from the menuQuick Action and assign it a keyboard shortcut Ctrl+command+T. enter image description hereThis will open the app but won't open any more windows (so if the app is open the keyboard shortcut doesn't have an effect).

  2. Add an iTerm2 key mapping to open subsequent windows. In iTerm2 preferences: enter image description here

There you have it, no external app needed but far from straight forward

2
  • Thanks. Note that some keyboard shortcuts dont work randomly. For instance, just F4 didnt work to open an app I wanted. However, Command+F4 worked. Nov 2, 2020 at 16:57
  • Great one! Just a few hints: Remember to store the shortcut in Automator with Cmd + S. Todoist users have to change the command because Ctrl + Cmd + T is already used there.
    – mhellmeier
    Nov 27, 2020 at 16:58
9

5 months late, but I think this bit is useful.

As far as an automator solution goes this is probably a little better. Instead of running finder just use an applescript. ie add action "Utilities Run AppleScript". Run this script:

on run {input, parameters}

    tell application "Terminal"
        do script " "
        activate
    end tell

    return input
end run

This will not only open terminal, when run multiple times it will open multiple windows. Then just add a hotkey for it in services (under keyboard), as explained in George Garside's answer.

2
  • 1
    error when saving: Expected end of line but found "script" Apr 5, 2015 at 21:42
  • 2
    You can find useful this stackoverflow answer, it is the same approach than @tlane answer but very detailed in it's implementation, very useful for someone totally new to MacOS.
    – Rodrirokr
    May 23, 2018 at 20:38
4

You can do this very easily with BetterTouchTool:

btt-snapshot

As the "Specific Application" to open the selected/active folder with, I chose Terminal.

Thus when I use the keyboard shortcut specified (I use option-'), the current Folder is opened in the Terminal.

4

In iTerm2, you can go to iterm preferences, keys -> hotkeys -> set in your key command.

3

If you want to use iTerm (iTerm2), do the same as @tlane's answer, except use this for the AppleScript:

on run {input, parameters}
    if application "iTerm" is running then
        tell application "iTerm"
            create window with default profile
            activate
        end tell
    else
        tell application "iTerm"
            activate
        end tell
    end if

    return input
end run
2
  • I added this in automator, and within automator, it works great. However, when I assign a keyboard shortcut for this service, it does nothing. Is there anything else I need to watch out for?
    – s-heins
    Feb 15, 2018 at 9:55
  • @s-heins perhaps the keyboard shortcut you tried is already used by other software such as the OS? I used control+option+command+T, and that worked.
    – ericcodes
    Feb 28, 2018 at 22:01
3

The closest I've come with macOS as-is and no mods or 3rd party software:

  1. Cmd+Shift+u
    Opens the Utilities sub-folder in /Applications/ (where Terminal.app lives)
  2. t
    Selects the Terminal.app
  3. Cmd+Option+o
    Opens the Terminal.app and closes the finder window.

This has worked since day one with every OSX release.

With a slight modification to System Preferences >> Keyboard >> Shortcuts::Services, this is a close runner up, but it requires that you select a folder first: enter image description here

...for example from the Finder at login you could

  1. Cmd+Up Arrow and your home directory ~/ would open in the Finder, then
  2. Cmd+Up Arrow again to the /Users/ directory. Now your user home directory ~/ should be selected (if in list or icon view, not column).
  3. If you then hit your custom "Services" key combination (e.g. Ctrl+Opt+Cmd+t) to launch a "New Terminal at Folder" the Terminal.app will launch at your home directory ~/

Lastly, in an effort to get something as close as possible to launching a Terminal.app window from the Finder with Ctrl+Alt+t... Since the Option key is kinda equivalent to the Alt key... using the "Services" custom key combo to launch a "New Terminal at Folder" you could also create an alias of your home directory on the desktop. If you rename the alias Space, then from the Finder it's:

  1. Space to select your ~/ alias, then

  2. Ctrl+Opt+t to Open a Terminal there.

...and you end up with a little home living on your desktop which has an arrow pointing to it:

enter image description here

2

Use Quicksilver

  1. Make a new Trigger in Quicksilver by opening Triggers (Cmd+' when Quicksiver is opened)
  2. Click the +▾ button at te botten of the list and select Keyboard

Add new keyboard shortcut to a app

  1. Type terminal and this wil show terminal.app then press Enter or click the Save button

  2. Assign a keyboard shortcut to that trigger by clicking on Keyboard and a slide out window wil, er, slide out

  3. Then, lastly, click on the empty box after Shortcut: and press your favourite key combination

Quicksilver Triggers overview

2

You can do this without using any 3rd party applications:

  • Open Keyboard settings and navigate to Shortcuts tab
  • Now, goto App Shortcuts
  • Click on + symbol, choose your Terminal app (If you haven't found the Terminal app, choose "other" and will navigate to the Finder, then search for Terminal)
  • naming the shortcut and the shortcut keys that would like to give.
3
  • 2
    I wish that would work, but they say: "You can’t create keyboard shortcuts for general purpose tasks, such as opening an app" (support.apple.com/guide/mac-help/…), however there seems to be a solution with automator (not tested yet): appleinsider.com/articles/18/03/14/…
    – ling
    Nov 26, 2018 at 4:59
  • Has anyone had success with this process? This did not work on Catalina
    – gatorback
    Jul 27, 2020 at 2:56
  • Thanks man, works perfectly on Big Sure. Nov 26, 2020 at 22:22
0

Adding my answer because if you're a linux person trying to get out of this hell, the solution I found is:

  1. Using BetterTouchTool2 to map Ctrl-Cmd-T to run Cmd-N in specific application but..
  2. Use Alacritty as terminal. This very light terminal window does NOT assume the apple parent / child hierarchy.

The one gotcha is that Alacritty has to actually be running already, so I added it to my login apps. I use LOTS of terminals so I don't care about this limitation. The chances of me not having a terminal window open on some desktop is close to none. As a bonus, I can now open multiple terminals with my preferred keyboard shortcut AND "alt-tab".. or Apple Tab between them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .