In Xcode I'd like the ability to set up several key bindings for the same function. For example, I'd like the step over function to be mapped to both F6 and F16. I don't see a way to do this from Xcode itself.

Does anyone know a way to do this? (I'm using Xcode 4.2.1)


I researched a bit on your question. Natively it seems that there is no way to specify multiple shortcuts for the same function -- I've tried to open ~/Library/Prefences/com.apple.dt.Xcode.plist file and manually edit the NSUserKeyEquivalents adding a duplicate element for Step Over, but upon Xcode startup the duplicate element was automatically deleted (it makes sense since the wrapping element is named <dict>).

I've found a rough way to set the second shortcut, inspired by this article. Instructions are for OS X 10.8:

  1. in System Preferences, under Accessibility enable Enable access for assistive devices;
  2. download and install Quicksilver, a free launcher for OS X;
  3. save the following AppleScript to Documents folder (for example with name StepOver.scpt) -- be sure to copy also the ¬ characters. This scripts activates Xcode and selects the Step Over function.

    tell application "Xcode"
    end tell
    tell application "System Events" ¬
    to tell process "Xcode" ¬
    to click menu item "Step Over" ¬
    of menu "Debug" of menu item "Debug" ¬
    of menu "Product" of menu bar item "Product" ¬
    of menu bar 1
  4. launch QuickSilver and navigate to Preferences -> Triggers -> Custom triggers

  5. create a new trigger, in which you open StepOver.scpt script using the hot key you want (in the screenshot I've used F10). In the Scope tab you can specify that the trigger only works in Xcode. trigger example
  6. at this point the additional shortcut should work, I've built a basic console C++ application in Xcode and I could step over using using F6 (as "standard" shortcut) and F10 (as additional shortcut configured with QuickSilver).

As a final note, you could also evaluate software to create macros like Keyboard Maestro -- it's commercial and I haven't tried it.

  • 1
    tell application "System Events" to tell process "Xcode" to click menu item "Step Over" of menu "Debug" of menu item "Debug" of menu "Product" of menu bar item "Product" of menu bar 1 work just as well without additional set-up code. – Daniel Beck Dec 30 '12 at 20:08
  • Thanks @DanielBeck, I'm not familiar with AppleScript. I've edited my answer and simplified this part using with your suggestion -- now the code is more readable. – edymtt Dec 30 '12 at 20:17
  • This works! It's a little complicated to set up, but only took about 2 minutes. I think I like Quicksilver as a tool I could use for a few other things. Thanks for figuring this out! – joseph.hainline Dec 31 '12 at 2:57

You can use the keyboard shortcut mapper for this process see attached image.

enter image description here

I hope this helps you

  • I was so hopeful this would work! When I tried it, only the F16 keyboard shortcut worked, and F6 no longer worked from within XCode (it just made the error sound instead of doing anything). The system level mappings seem to overwrite the app level mappings. I'm using XCode 4.5.2 and OSX 10.8.2. Did this work for you, and what versions are you using? – joseph.hainline Dec 18 '12 at 3:42
  • Hi there sorry it wasn't complete;y correct use ctrl+f6 this will work alongside f16 that is the best I think you can get my apologies. – Justin Erswell Dec 18 '12 at 8:37
  • Thanks for the attempt, but I guess what I'm looking for is simply not possible. Ctrl+F6 is a different command than F6. When I map at the system level, it just overrides the app level. I'm really trying to get two keys mapped at the same time to the same function. – joseph.hainline Dec 19 '12 at 3:14

I do this with Keyboard Maestro. You can assign a command to one or more applications or global. It's a fantastic piece of software I can't live without. It's the best piece of software I've ever bought. You would be shocked to see how many key bindings I have.

Attached is an image where I map a hotkey to a menu item. Ignore the action grayed-out in the image. It starts off with "Execute Macro". Menu Select is the action you want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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