Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I continually hit ⌘-P and ⌘-S while Terminal is in focus, due to alt-tabbing between my text editor and other programs.

Does anyone know how to disable these keys in

share|improve this question
up vote 3 down vote accepted

You could try out Keymando which will let you set specific shortcuts for programs. In this case, you would set those commands to do nothing.

Another solution would be to use iTerm 2, which allows you to specify shortcuts for keys (or to ignore).

share|improve this answer
Definitely recommend iTerm 2. Great app, and constantly has updates too! – Richard J. Ross III Oct 26 '12 at 21:12
For iTerm2 to "disable" Print: Prefs > Profiles > Default > Keys > Add shortcut key ⌘-P > Ignore. – Chris Burgess Aug 12 '13 at 23:55
on iterm2 if i ignore CMD+P it will allow me to map CMD+P on vim? – Arnold Roa Apr 8 at 14:40

Removing a Default Keyboard Shortcut in OS X

TL;DR Version

Run the following two commands in Terminal, then restart it.

defaults write NSUserKeyEquivalents -dict-add "Export Text As..." nil
defaults write NSUserKeyEquivalents -dict-add "Print..." nil

Full Explanation

You can use the defaults command to disable a built-in keyboard shortcut for an app (for a custom shortcut, just remove it from Keyboard Preferences).

To disable it, you need to know the exact name of the menu item the shortcut is associated with and the bundle identifier of the app.

To get an app's bundle identifier, run osascript -e 'id of app "AppName"' in Terminal, replacing AppName as appropriate.

Once you have that information, the proper command is:

defaults write BUNDLE_ID NSUserKeyEquivalents -dict-add "MENU_ITEM" nil

Followed by a restart of the app.

Restoring the Shortcuts

If you want to undo this, you can either remove the entries in Keyboard Preferences if they appear there (they don't always), or rewrite the NSUserKeyEquivalents dictionary.

First, check if you have any other shortcuts set, by running defaults read BUNDLE_ID NSUserKeyEquivalents.

If you only see the entries you created, then you can just run defaults delete BUNDLE_ID NSUserKeyEquivalents and restart the app.

If there are other entries (most likely custom shortcuts you set in Keyboard Preferences), then you need to modify the entry, read below.

Selectively Restoring Default Shortcuts

Run defaults read BUNDLE_ID NSUserKeyEquivalents. You'll get some output like this:

    "Other Shortcut" = "@\\U2190";
    "Export Text As..." = nil;
    "Print..." = nil;

Remove the lines you want to reset (Export and Print), then copy the remaining output as-is; make sure to include the curly brackets. Then type (but don't yet run) defaults write BUNDLE_ID NSUserKeyEquivalents '. Paste your modified text after that (be sure you included the single quote before pasting), then close the single quote (') and run the command. Once you restart the app, the default shortcuts should be restored, while keeping any existing ones.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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