58
votes

First of all, here's the userland question: Disabling mouse acceleration in Mac OS X @ superuser

To summarize: I want to have linear mouse response on Mac OS X. That is, no acceleration; an adjustable but constant pixels pointer moves / meters mouse moved ratio.

I have no idea how to go about this. (Well, not true, but it's better to start from scratch.) Should I write a mouse driver? A startup program? A click-and-forget settings adjuster? A preferences pane?

I want my solution to be as simple, universal and unintrusive as possible, so some criteria might be:

  • Works on Snow Leopard (10.6.5) and later - much later, unless an important piece of the API gets deprecated
  • Works on mice but not touchpads, tablets, magic wands... (Or maybe configurable?)
  • Can easily be applied/run by other people who want the same thing (all 42 of us on the planet)

I'm a fairly experienced C programmer, both in user and kernel space (in Linux and Windows), but know next to nothing about Mac OS X or Darwin. So anything is appreciated, really ("can't distribute drivers without certificate from Apple") but some documentation/reference would get me a long way ("Darwin's Next Generation Mouse Curve Editing API and Examples").

I know the question is a bit open but I don't even know what kind of a solution could work. Thanks in advance.

Edit: Although I've asked both questions to solve the same problem, this is the programmatical counterpart to the other one. (See the first sentence of this question.) Here I'm trying to create my own solution, so to speak, using - I don't know - some HID API? A driver? A solution on the lines of "open current user's prefs file and change this setting to this" should probably be posted on the other question, but note that such a solution probably doesn't exist.

1
I suppose what you really want is to make cursor feel the same as in Windows with acceleration off. In that case, the problem is bigger than just acceleration. Check d43.me/blog/1205/…hamstergene
To bring it back on topic, I've just found this: forums3.armagetronad.net/viewtopic.php?t=3364Beetle
smoothmouse.com seems to be the solution. It works great on my MacBook Air running Mavericks.carlito
@lorenzo Bless you! If you'll add that as an answer to superuser.com/questions/218314, I'll upvote it.Johann
@Johann Thank you! I added that as an answer on superusercarlito

1 Answers

73
votes

This answer is on the wrong website!

A lot of my reputation on StackOverflow has come from people voting up this answer, which I wrote way back before I realised that there are several stack exchange websites and that StackOverflow is for programming questions and answers only. Therefore the question above is about how to tackle this if you want to code your own mouse drivers. For all other discussion, go have it here on the superuser site where it belongs.

Original answer follows.


Explanation

There's a hidden preference that you can change from the Terminal. To read its current value type

defaults read .GlobalPreferences com.apple.mouse.scaling

at the Terminal prompt. Normal values are 0 ~ 3, which can be set by moving the 'Tracking Speed' slider in the Mouse pane of System Preferences. Values of 0 ~ 3 won't disable acceleration, therefore.

How to Disable Acceleration

However, if you set it to -1 by typing

defaults write .GlobalPreferences com.apple.mouse.scaling -1

in the Terminal, that seems to disable acceleration and set the mouse tracking speed to some constant predefined value which you can't change.

I found I had to log out and back in again for it to take effect. After that, the pixels pointer moves / meters mouse moved ratio is constant but unfortunately not adjustable.

How to Undo Changes

To revert back to Apple default settings, just open the Mouse pane of System Preferences and change the Tracking Speed to anything, then quit System Preferences.

Mouse ≠ Trackpad

Mac OS X stores mouse and trackpad settings independently. If you want to disable acceleration on a trackpad instead of a mouse, the instructions are the same, just replace with com.apple.trackpad.scaling wherever you see com.apple.mouse.scaling in the above (and use the Trackpad pane of System Preferences instead of the Mouse pane, obviously).

Notes

I won't cite a source, since this tip is available in many places on the web. I tried it in OS 10.7 Lion, but many of the sources claim to be using 10.6 Snow Leopard.