Ubuntu on MacBook Pro - Magic Mouse / TrackPad Settings
If you’ve ever installed Ubuntu or another Linux distro on your MacBook, MacBook Pro, or iMac, you’ve probably run into one persistent frustration: the Apple Magic Mouse and Trackpad just don’t behave like they do when running macOS, but normal ‘Windows” mice work fine.
After pairing via Bluetooth, you might notice that the right-click (secondary click) doesn’t work, the left-click only registers on the far edge, and scrolling or gestures are unreliable at best, if not have a complete mind of their own!
For devices that feel magical on macOS, they can seem downright clunky on Linux. But don’t worry there s a clean, open source solution that fixes everything, its called ‘Magic Mouse HID driver for Linux’ by Ricardo Rodrigues. This lightweight driver re-enables full Apple-style functionality for both the Magic Mouse and the Magic Trackpad under Ubuntu all in under ten minutes.
The Problem: Apple Magic Mouse on Ubuntu
When you connect your Magic Mouse or Trackpad to Ubuntu, it’s recognized as a generic HID (Human Interface Device). The Linux kernel includes a basic driver (hid_magicmouse), but it lacks the full Apple-specific support you’re used to, as you’ll know from using a Windows mouse with macOS there is something different about these magic mice and that’s why they don’t work like they should. It’s frustrating because the Magic Mouse hardware itself is excellent it just needs the right software layer.
Typical issues include:
Right-click not working (or only works occasionally)
Left-click zones inconsistent, requiring firm presses on the far left side
No smooth scrolling or gestures
Battery percentage not reported correctly
Overall lag or stutter when using Bluetooth
The Solution: magicmouse-hid Driver
That’s where the Linux-Magic-Trackpad-2-Driver project comes in. Developer Ricardo E. P. Rodrigues created a modern replacement for the kernel’s built-in driver. His project, hosted on GitHub as Linux-Magic-Trackpad-2-Driver, adds proper gesture handling, right-click recognition, and full multitouch support for:
Apple Magic Mouse (1st & 2nd Gen)
Apple Magic Trackpad (1st & 2nd Gen)
The driver is distributed as a DKMS module (Dynamic Kernel Module Support), which means it automatically rebuilds itself whenever Ubuntu updates your kernel no need to reinstall it every time you upgrade.
How to Install the Magic Mouse / Trackpad Driver on Ubuntu
The process is simple and safe. It doesn’t modify your kernel permanently and can be uninstalled easily.
Step-by-Step Guide
Open your terminal and run the following commands one by one:
# 1. Install DKMS and Git
sudo apt install dkms git -y
# 2. Clone the repository
git clone https://github.com/RicardoEPRodrigues/Linux-Magic-Trackpad-2-Driver.git
# 3. Move into the folder
cd Linux-Magic-Trackpad-2-Driver
# 4. Make the installer executable
chmod u+x install.sh
# 5. Install the driver
sudo ./install.sh
When the installer completes, reboot your machine or reload the module manually:
sudo modprobe hid_magicmouse
What Gets Fixed
| Feature | Before | After Installing Driver |
|---|---|---|
| Right-Click | Broken or inconsistent | Works perfectly |
| Left-Click | Only far left edge | Works across full surface |
| Scrolling | Jerky, slow | Smooth, natural |
| Gestures | Limited or none | Supported (depending on model) |
| Battery | Not shown | Reported accurately in system settings |
How to Uninstall
If you ever want to remove the driver, it’s easy:
cd Linux-Magic-Trackpad-2-Driver
./uninstall.sh
When I first paired my Apple Magic Mouse with Ubuntu on a MacBook Pro, it was nearly unusable. Right-click didn’t work, scrolling was jerky, and simple navigation felt broken.
After discovering Ricardo Rodrigues’s magicmouse-hid driver, the difference was night and day. It’s one of those small tweaks that completely changes your Linux experience on Apple hardware, we’re slowly getting to the point everything just works the way it should. (Shame the graphics card couldn’t hey!!), We’re also getting updates and security patches running modern Linux which includes a modern browser too.
If you’re running Ubuntu (or any Linux distro) on a Mac, this is an essential setup step. With just a few terminal commands, your Magic Mouse and Trackpad regain their “magic.”
Make sure you read the full page https://github.com/RicardoEPRodrigues/magicmouse-hid?tab=readme-ov-file which includes bug fixes for bluetooth issues or your mouse not reconnecting after a reboot.
