I want to create a keyboard shortcut to i.e. open Firefox while I am working in another application. I know I can use ⌘ CMD+T when I am in Firefox to open a new tab.

I haven't found a way to create that kind of shortcuts in System Preferences.

Any ideas?

  • 1
    So you mean keyboard shortcuts? Aug 5, 2011 at 13:24
  • Look at the Services on the Application menu any reasonably written Cocoa app will have these and they can be assigned keys. Unfortunately I think Firefox is not written to use these. Safari can be used here
    – mmmmmm
    Mar 19, 2013 at 12:02
  • This may not have been an option in 2011 when the question was first asked, but it's now pretty easy to do using Automator. See howtogeek.com/209725/… for a tutorial. May 4, 2016 at 18:59
  • It's fairly amazing to me that Apple, with its vaunted usability, has not seen it fit to build into MacOS a straightforward way of assigning a key shortcut for launching an application. Jan 4, 2017 at 11:33

12 Answers 12


Karabiner-Elements (10.12 and later)

Karabiner stopped working in 10.12 due to changes in the kernel architecture, and Karabiner was rewritten as Karabiner-Elements which uses a new JSON format for the configuration files.

You can now add a rule like this to karabiner.json:

  "from": {
    "key_code": "t",
    "modifiers": {
      "mandatory": ["right_option"]
  "to": [
      "shell_command": "open -a terminal"
  "type": "basic"

This makes a short press of the right command key open Emacs:

  "from": {
    "key_code": "right_command",
    "modifiers": {
      "optional": ["any"]
  "to": [
      "key_code": "right_command",
      "lazy": true
  "to_if_alone": [
      "shell_command": "open -a emacs"
  "type": "basic"

Karabiner (10.11 and earlier)

Save a file like this as private.xml:

<?xml version="1.0"?>
    <autogen>__KeyToKey__ KeyCode::F11, KeyCode::VK_OPEN_URL_Safari</autogen>

    <!-- change the right option key into an extra modifier key -->
    <autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::VK_MODIFIER_EXTRA1</autogen>

    <autogen>__KeyToKey__ KeyCode::I, ModifierFlag::EXTRA1, KeyCode::VK_OPEN_URL_iTunes</autogen>

    <!-- make a short press of the right command open Emacs -->
    <autogen>__KeyOverlaidModifier__ KeyCode::COMMAND_R, KeyCode::COMMAND_R, KeyCode::VK_OPEN_URL_EMACS</autogen>

Alfred 2

If you have bought the Powerpack for Alfred 2, you can create a workflow like this:

Screenshot of a workflow in Alfred

Hotkeys have a short delay by default, but you can reduce the delay by changing the "Trigger behaviour" option from "Simulate modifier keys released" to "Pass through modifier keys (Fastest)":

Screenshot showing the change in 'Trigger behaviour'

Automator services

Open Automator, select "Service" as the type of the document, change "Service receives" from "text" to "no input", add a "Launch Application" action, and save the service.

Screenshot of Automator to create a workflow for launching an application

Then assign a keyboard shortcut for the service from System Preferences > Keyboard > Shortcuts > Services.

Screenshot of the Keyboard Prefs Pane with a shortcut to Open Terminal

I don't recommend this option, because at least on my system, there is at best a delay of around half a second before an application is focused by a keyboard shortcut created using this method, and the delay is often even longer. There has also been a bug since 10.7 where the keyboard shortcuts for Automator services don't always work until you hover over the services menu from the menu bar. (Edit: it's now 8 years after I wrote this answer and the bug still hasn't been fixed.) Also, the keyboard shortcuts for services are not available in some applications like Emacs.

  • 4
    private.xml WHERE? Anywhere? Does it already exist? I can't find it. Where does it go? Jul 2, 2014 at 19:21
  • @boulder_ruby, /Library/Application Support/Karabiner/private.xml. Or open Karabiner GUI > misc&uninstall tab > "Open private.xml" tab. I had the exact same difficulty. Aug 12, 2016 at 22:26
  • Karabiner-Elements is awesomer, now that I know I can modify its settings directly in a json file. Thanks! 😃 May 12, 2019 at 19:19
  • 2
    Put the automator one at the top its the easiest to do for most people
    – Harry
    May 12, 2019 at 21:53
  • +1 for Alfred, such an awesome tool. I love the clipboard history which you get from Alfred as well.
    – Jim Aho
    Mar 30, 2022 at 19:59

I found Apptivate the easiest to use. You just select an application and you assign a global shortcut. That's it.

  • 2
    This deserves more upvotes. Surprisingly nifty app! Feb 10, 2020 at 17:35
  • Perfect. Precisely what I sought, and nothing more.
    – theherk
    Nov 2, 2021 at 14:01


Alfred, in its Power Pack version, can map shortcuts to applications, among many other features.


If you do not want to use third party apps.
Then you can use Automator (Services ), and the Built in keyboard shortcuts.

Here is how in an answer to a similar question.

Very simple.

In Step 3, of creating the service.
Set it to 'any application' .

set Service receives to: 'no input' in 'any application' (Do this by using the drop downs at the top.)


Get Quicksilver, http://www.blacktree.com/, it will allow you to set keyboard shortcuts to open apps. There are actually more many more apps that do this (Alfred, Keyboard Maestro etc etc.)

Mac OS X actually has a built-in way of doing that, but it doesn't work for Firefox, because it doesn't support services! http://hints.macworld.com/article.php?story=20090903085255430

Update Jan 2012: Blacktree no longer updates Quicksilver--the developer went to Google and has released Google Quick Search Box. Quicksilver lives on, but it has a new home at qsapp.com.

  • Thanks. Was very helpful to me. used Google but didn't find your link.
    – politicus
    Aug 4, 2011 at 7:41
  • Cool, so you came right? Aug 4, 2011 at 11:02
  • 1
    "Yes". Installed Quicksilver (very powerful, certainly better than having just a shortcut). Tried Keyboard Maestro. Now having a rest before learning all these shortcuts ;-)
    – politicus
    Aug 4, 2011 at 13:41
  • Quicksilver is great. Thanks so much for the advice. I created a bash script to open gmail and another to open mysms in the browser. Then I used the appify script to make them OS X apps. From there I could use Quicksilver to have my keyboard shortcuts to launch those. Very nice to have. mathiasbynens.be/notes/shell-script-mac-apps
    – jbrock
    Jan 31, 2015 at 21:39

As of macOS Monterey, you can set up a global hotkey via the Shortcuts app. This will either launch the app or switch to it if it's already running.

Use the Open App option and under settings, pick a shortcut from 'Run with'.

Works together nicely with a hyper key.

macOS Monterray shortcut to launch an app from a key binding


There are plenty of good options here but I wanted to add my personal favorite which I've been using since 10.5 and still works on 10.11.2: Spark 3.


It's freeware and extremely easy to set up. Here's the developer's description:

Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, control iTunes, and more... You can also export and import your Hot Keys library, or save it in HTML format to print it. Spark is free, so use it without moderation!

Here's a screenshot of the interface:

Spark User Interface


To open the Terminal with a keyboard shortcut without any third-party software:

  • Open Automator (⌘ + Space, then type Automator)
  • Go to File -> New
  • Select Quick Action (or Service, depending on your Mac version)
  • Where it says Workflow receives, select no input:

how to open a mac terminal with keyboard shortcut

  • In the Actions column, search for Run AppleScript and drag it to the right column
  • Paste this in the script area:

    on run {input, parameters}
        tell application "Terminal"
            do script ""
        end tell
    end run

PS: Remove do script "" if you don't want a new instance of the terminal every time you press the hotkey.

  • Click on File -> Save and name it anything you want

mac open terminal with keyboard shortcut

  • Now close Automator and open System Preferences -> Keyboard -> Shortcuts
  • In the left column, click on "Services"
  • Scroll down to the very bottom, you should see the script you just saved. Click on none to assign a hotkey to it.

One important thing to consider, though, is that the hotkey must be unique across all applications. If you assign a common hotkey, such as ⌘ + T, and try to open the terminal while browsing, it will conflict with most browser's hotkey to open a new tab, so it won't work. That's why you should try a shortcut that won't conflict with any app.

I've chosen ⌘ + ⌥ + F12. Works pretty well.


If you're using iTerm2 + Oh My Zsh, just replace Run AppleScript with Launch Application in Automator, and select iTerm.app from the list.

  • You don't need to use AppleScript: there is a Launch Application action.
    – benwiggy
    Aug 15, 2019 at 13:56

I know Alfred has already been mentioned, but I thought I'd say a little bit about choosing shortcut keys. It was not obvious to me at first what would be a good set of shortcuts that was (a) easy to remember, (b) easy to use, and (c) did not conflict with other system or application shortcut keys.

I ended up using the "alt" key as the basis, and generally relying on keys that can be triggered by the left hand, and choosing descriptive letters (e.g., x for Excel). this allows you to have the mouse in the right hand and the shortcut keys triggered with the left.

Another benefit of using Alfred Hotkeys to activate an application is that if an application is hidden, it will be unhidden.

Here's a screen shot of how I have it configured: example alfred hotkey configuration



There is a nice clean open source app for this called Thor. It enabled you to assign global shortcuts to applications.

enter image description here

Download the binary from the App Store here https://itunes.apple.com/app/thor/id1120999687?ls=1&mt=12. The project page is here https://github.com/gbammc/Thor.


If the Application is Terminal, this already has shortcut keys configured in Preferences: System Preferences Keyboard Shortcuts New Terminal at Folder ^++T

New Terminal at Tab Folder +^++T

  • Note that I would have answered this in the shortcut key for Terminal launch questions. However they cannot be answered as they are marked as duplicates of this question. Aug 15, 2019 at 13:50

Tested on macOS Monterey

  1. Open the shortcuts app

  2. Click on + (new shortcut)

  3. In the right sidebar search and double-click/drag run AppleScript

  4. Paste script

    on run {input, parameters}
     tell application "Terminal"
     end tell
    end run

The best thing is you can assign the keyboard shortcut within the same app itself.

  1. Navigate to shortcut details in the right sidebar.
  2. You can find Add keyboard shortcut

You must log in to answer this question.

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