Apple - How can I set a keyboard shortcut that includes the backspace key?

To change the shortcut of a service, run plutil -convert xml1 ~/Library/Preferences/pbs.plist, open the plist, and change for example

<key>(null) - Some Service - runWorkflowAsService</key>
<dict>
    <key>key_equivalent</key>
    <string>@~a</string>
</dict>

to

<key>(null) - Some Service - runWorkflowAsService</key>
<dict>
    <key>key_equivalent</key>
    <string>@~&#x8;</string>
</dict>

Then restart to apply the changes.

@ is command, ~ is option, and &#x8; is delete (Windows backspace). Forward delete (Windows delete) would be &#x7f;. The shortcut strings use the same format as in DefaultKeyBinding.dict.

To change a global shortcut set in the App Shortcuts section, run plutil -convert xml1 ~/Library/Preferences/.GlobalPreferences.plist, open the plist, and change for example

<key>Some Menu Name</key>
<string>~@a</string>

to

<key>Some Menu Name</key>
<string>~@&#x8;</string>

Then quit and reopen applications to apply the changes.

Application-specific shortcuts are stored in ~/Library/Preferences/*.plist and ~/Library/Containers/*/Data/Library/Preferences/*.plist.


The favorite answer here is substantially correct. However, pasting "" for backspace didn't work for me. It wound up as 8 in the menu. The technique that worked for me was to open the Emoji and Symbols viewer.

I just signed up to Stack Exchange and have no reputation points, otherwise I would have just replied to the answer above. You can follow the instructions in that answer up to the point where you need to type this string, and then use the instructions below.

You can press Control-Command-Space, or if that keyboard shortcut doesn't work, you can activate a menu from the Keyboard section of the Keyboard system preference pane by checking "Show keyboard and emoji viewers in menu bar."

  1. Use the shortcut, or from the menu bar, find the keyboard and emoji input menu icon for the keyboard and emoji input menu item and choose "Show Emoji and Symbols."
  2. By default, you'll see the Emoji window. In the top-right corner you'll see the same icon, which you can click to switch to the Symbols viewer.
  3. From the list on the left, choose Technical Symbols.
  4. Look for the symbol for "Erase to the left" (Erase to the Left symbol), which for me appears at the beginning of the third row.
  5. Make sure your text insertion point is positioned where you want to insert the symbol.
  6. Double-click on the symbol to insert it into the text.

From there you can save your plist and continue with the instructions from the original answer.

Also note that if you have Xcode installed, or another app that can read and edit plist files natively, you don't have to convert the plist to XML.

Tags:

Macos

Keyboard