Apple - Create global shortcut to run command line applications

Without knowing the specifics of what you are looking for, I'd suggest creating a new Service through Automator. Services can be bound to keystroke triggers, and can execute shell scripts (among other things). enter image description here

To set up the keyboard shortcut, go to System Preferences -> Keyboard -> Shortcuts -> Services, select the service you just saved, and then click the "Add Shortcut" button.


FastScripts includes all scripts in ~/Library/Scripts/, so you don't have to add files manually. It also supports application-specific scripts.

Other applications that can be used to assign shortcuts for running scripts:

  • Alfred
  • Apptivate
  • BetterTouchTool
  • Butler
  • Cockpit
  • Controller Mate
  • iKey
  • Keyboard Maestro
  • NuKit (only AppleScript)
  • QuicKeys
  • Quicksilver
  • Shortcuts (only AppleScript)
  • Spark
  • ThisService

You can also create an Automator service:

  1. Open Automator and choose the Service template
  2. Add a Run Shell Script or Run AppleScript action
  3. Check that the input type and application scope are correct
  4. Paste the script and save the service
  5. Assign a shortcut in the Keyboard preference pane

There's a bug in 10.7 and 10.8 where the shortcuts for services don't always work until the services menu has been shown from the menu bar. Shortcuts for services don't work when the frontmost application doesn't have a menu bar or a services menu. There's also a short delay before services are run.


I tried all those options, but they're too complex and unreliable or really expensive. So i ended up writing my own solution (open-source and free).

iCanHazShortcut

It can't do much right now, but that's a start. Feel free to contribute by adding feature requests and suggestions.