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, is there a way to start terminal like that in OS X Mavericks?

P.S. 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.

up vote 13 down vote accepted

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.

  • 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 '14 at 11:13
  • @Morpheus Added a method using KeyRemap4MacBook which is free – grg Feb 8 '14 at 11:20
  • should keyremapformacbook be open all the time for this to run? – Morpheus Feb 8 '14 at 11:26
  • @Morpheus The app doesn't need to be open — it adds a daemon. – grg Feb 8 '14 at 11:27
  • 1
    @grgaside, automator is not working but keyremap is working. SO thanks! – Morpheus Feb 8 '14 at 12:03

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.

  • error when saving: Expected end of line but found "script" – Brian Vanderbusch Apr 5 '15 at 21:42
  • 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 at 20:38

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.

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

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

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
  • 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 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 at 22:01

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.