How to map keyboard to mouse buttons in OS X

11,865

Karabiner(formerly known as KeyRemap4MacBook) does exactly that. It allows you to remap the right Command button to a left click:

enter image description here

The same is possible for the right option key too. It worked for me on a 2011 MacBook Pro running Snow Leopard—couldn't test it on a "normal" Mac, but it should work regardless of that.


There's an app called BetterTouchTool. In its Preferences, under Keyboard, you can set any keyboard shortcut to map to a primary or secondary click. The problem is that cmd and alt are modifier keys, so they aren't a keyboard shortcut recognized by the app.

Another program called DoubleCommand might be worth mentioning as well, but it does not emulate clicks.

Share:
11,865

Related videos on Youtube

P i
Author by

P i

Updated on September 18, 2022

Comments

  • P i
    P i over 1 year

    Severe RSI is causing me pain each time I click the mouse.

    I would like to map the right CMD and OPT (which I never use) to function as left and right mouse button.

    How can I accomplish this?

  • brevno
    brevno over 12 years
    None of those will make the key bound to a secondary click act like the Windows menu key though. You'll still need to move the cursor before pressing the key.
  • slhck
    slhck over 12 years
    @Lri I didn't experience any problems with it – what exactly do you mean?
  • brevno
    brevno over 12 years
    Like you can't use the primary or secondary click keys to perform actions on items focused with the keyboard.
  • P i
    P i over 12 years
    I have never used this functionality in OSX. If I can move the mouse with one hand and click with the other, this is enough.
  • snooze92
    snooze92 almost 10 years
    Can a key be mapped to "Hold mouse button"?