Makes your Mac trackpad purr like a cat purr.shenoi.dev
README.md

Purr logo: a smiling black cat face

Purr #

A tiny macOS menu bar app that makes your Force Touch trackpad purr like a cat. purr.shenoi.dev

Click the cat in the menu bar to start purring. Click again to stop. Rest a finger or palm on the trackpad to feel it: it feels best with the MacBook on your lap. The trackpad also hums the purr out loud a little.

Install #

Download Purr.dmg (the newest build from the tags page), open it, and drag Purr into Applications.

If the build is not notarized, macOS blocks Purr the first time you open it. Open System Settings → Privacy & Security and click Open Anyway, or run:

xattr -dr com.apple.quarantine /Applications/Purr.app

Purr is not notarized yet because that needs a paid Apple Developer account. To help pay for it, chip in $10 on GitHub Sponsors.

To start Purr at login: System Settings → General → Login Items → +.

Use #

Action Result
Click the cat Start or stop purring
Right-click (or Control-click) the cat Pick a cat, set the strength, or Quit

The cats #

Cat Purr
Mr. Beans The classic: steady and warm, about 25 purrs a second
Purrito A tiny kitten: fast, light and fluttery, with quick little breaths
Minister of Mice Old and dignified: a deep, slow rumble with long breaths
Sir Loafs-a-Lot Half asleep: soft, drifting and irregular, with long pauses
Chairman Meow Full motorboat: a buzzy square-wave rumble that hardly stops for breath

Use at your own risk #

Purr runs the trackpad's haptic motor for as long as it purrs, about 25 pulses a second, through a private Apple framework. Apple made that motor for short clicks, not for hours of purring, and nobody knows how much a long purr wears it. Purr comes as is, with no warranty (see the MIT License). Use it at your own risk, and stop it when you are done.

Requirements #

  • macOS 13 Ventura or later
  • A Force Touch trackpad: a MacBook Pro from 2015 on, a MacBook Air from late 2018 on, or a Magic Trackpad 2 or later. Tested on an Apple Silicon MacBook.

How it works #

There are three ways to make a Mac trackpad vibrate:

  1. NSHapticFeedbackManager (public AppKit API). It has three preset ticks and no strength control, and it only fires while a finger rests on the glass. Too weak for a purr.
  2. MTActuatorActuate (private MultitouchSupport.framework). It plays the built-in click waveforms (IDs 1–6, 15, 16) at a chosen intensity. Better, but every pulse is a click.
  3. MTActuationCreateFromDictionary + MTActuationActuate (private). It plays custom waveforms: a Gaussian pulse plus any mix of sine/square/sawtooth tones, with your own frequency, length and amplitude. Purr uses this.

A real cat purrs at about 25 Hz while it breathes in and while it breathes out, with a short break at each turn. Purr plays a 22 ms low rumble (60 Hz plus its harmonics, over a soft thump) about 25 times a second. The level swells and fades with each breath. The inhale is a little faster and softer than the exhale. Each pulse is a few percent early or late, so the purr sounds alive and not like a metronome.

Each cat changes the breath lengths, purr rate, rumble pitch and waveform, thump, wobble, and how far the purr fades between breaths. Every trackpad feels a bit different. All the cats and their tuning knobs are in Sources/Purr/Purr.swift. To add a cat, add a case to Cat.

To test a trackpad from a terminal, run Purr.app/Contents/MacOS/Purr --check. It plays one twitch of each cat and exits with code 1 if the driver rejects one.

Note: MultitouchSupport is a private Apple framework. A future macOS update could break Purr. That is also why Purr can't be on the Mac App Store.

Build from source #

Needs the Xcode Command Line Tools (xcode-select --install).

swift run -c release           # run it straight away
swift run -c release Purr --check
scripts/bundle.sh 1.0.0        # universal dist/Purr.app + dist/Purr.dmg, ad hoc signed

scripts/bundle.sh reads three environment variables:

  • BUNDLE_ID: the app's bundle identifier. The default is dev.shenoi.purr.
  • SIGN_IDENTITY: a Developer ID to sign with, using the hardened runtime. The default is -, which means ad hoc signing.
  • NOTARY_PROFILE: a notarytool keychain profile. When it is set, the script notarizes the DMG and staples the ticket to it.

For a release that opens without a warning, you need an Apple Developer account:

xcrun notarytool store-credentials purr --apple-id YOU@EXAMPLE.COM --team-id TEAMID
SIGN_IDENTITY="Developer ID Application: NAME (TEAMID)" NOTARY_PROFILE=purr scripts/bundle.sh 1.0.0

The logo has one source, assets/logo.svg. After a change to it, run scripts/icon.sh (needs Inkscape). It renders the app icon, the menu bar icons and the website images from that file.

Website #

site/ is the static website, with no build step. It runs as a Cloudflare Worker that serves static files, configured in wrangler.jsonc. To deploy, run npx wrangler deploy. The link preview, site/og.png, is a picture of the page's top half: after a change there, run scripts/og.sh (needs Google Chrome) to render it again. The cats in site/index.html mirror Sources/Purr/Purr.swift, so keep the two in step.

Credits #

The private API calls are based on the reverse-engineering work in os6/nospeaker (MIT), mrkai77/Subsurface (Apache-2.0), and HapticKey.

License #

MIT