Open-source project
taigrr/spank avatar
taigrr/spank

spank reads the Apple Silicon accelerometer and answers slaps with MP3 clips

Slap your MacBook, it yells back. Uses Apple Silicon accelerometer via IOKit HID.

5,029 stars265 forksGoMIT

At a glance

What is it?
taigrr/spank is a single Go binary that watches the Bosch BMI286 motion sensor on M-series MacBooks through IOKit HID and plays a clip when something hits the chassis. The supported hardware list is narrow, every run needs root, and the documented fast profile disagrees with the sensitivity scale.
Who is it for?
spank fits someone with an M2 or newer MacBook, or an M1 Pro, who wants the machine to answer a slap and accepts running it as root. It is the wrong choice on Intel Macs, on base M1 and M1 Max hardware, and anywhere a physical impact is not how you want a sound triggered.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 23 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • taigrr/spank5,029 ★ · +25
Star history
Repository2026-09-232026-11-15
taigrr/spank5k5k

25 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The sensor path goes straight to IOKit HID

spank opens the motion sensor itself rather than going through a wrapper. The pipeline runs in six steps: raw accelerometer data is read directly via IOKit HID from the Apple SPU sensor, vibration detection runs (STA/LTA, CUSUM, kurtosis, peak/MAD), and a significant impact plays an embedded MP3 response. A 750ms cooldown sits between responses so a single hit cannot machine-gun the speakers, and --cooldown moves that number.

The IMU underneath is a Bosch BMI286. The README credits both the sensor reading and the vibration detection as ported from olvvier/apple-silicon-accelerometer, and go.mod pins that as github.com/taigrr/apple-silicon-accelerometer v0.1.0 next to three other direct modules: spf13/cobra v1.10.2 for flag parsing, charmbracelet/fang v1.0.0 for the help output and gopxl/beep/v2 v2.1.1 for playback, with ebitengine/oto/v3 v3.4.0 and hajimehoshi/go-mp3 v0.3.4 among the indirect modules beneath it. So the single binary claim describes what you install, not what a build links.

go.mod declares go 1.26.4 while the requirements ask for Go 1.26+ if you compile from source, which means a stock toolchain one patch release behind the module line is not enough.

The requirements rule out most M1 chips and every A-series Mac

The requirements section is short and unusually specific: macOS on Apple Silicon, meaning any M-series chip from M2 upward, or the M1 Pro SKU specifically, with no other M1 or A-series chips. Then sudo for IOKit HID accelerometer access, and Go 1.26+ when building from source.

That allowlist is the first thing to check against the machine in front of you. Base M1 and M1 Max are not on it, and no documentation explains which sensor identifier differs on those chips or how to query it from a terminal. Intel Macs are missing as well, because the design assumes an Apple SPU sensor is present in the machine.

The consequence is that an excluded chip leaves you without a diagnostic. Nothing states what the program prints or exits with when the sensor path is unavailable, so there is no error string to match against in a support ticket or a shell script. Check the exact SKU before you install anything, and on shared or fleet hardware prefer the downloaded binary over a local build until you have confirmed the chip qualifies.

go install puts spank where sudo cannot see it

Two routes are offered: download the binary from the latest release page, or build it with the Go toolchain. Building is one command, and where the binary lands matters:

bash
go install github.com/taigrr/spank@latest
sudo cp "$(go env GOPATH)/bin/spank" /usr/local/bin/spank

go install writes to $GOBIN when that variable is set, otherwise to $(go env GOPATH)/bin, which defaults to ~/go/bin. The copy step exists because that directory is not on the PATH sudo sees, so sudo spank would fail from there. Putting the file in /usr/local/bin is what makes every later example work, including the launchd plist, which calls /usr/local/bin/spank by absolute path.

The first run takes no configuration:

bash
sudo spank

That is pain mode, and it says ow when a slap is detected. No quit key, no hotkey, and no console output while it waits are documented, so stopping it means returning to the terminal that launched it. Since every run asks for an administrator password, try it in the foreground first.

Pain, sexy, halo and custom are four different clip pools

Four audio pools, picked by flag at launch. Pain mode is the default and chooses at random from 10 pain or protest clips. Sexy mode (--sexy) tracks your slaps inside a rolling 5-minute window and escalates the response as the count rises, across 60 levels. Halo mode (--halo) draws on death sound effects from the Halo video game series. Custom mode (--custom) plays MP3 files at random from a directory you name.

bash
sudo spank
sudo spank --sexy
sudo spank --halo
sudo spank --custom /path/to/mp3s
sudo spank --fast
sudo spank --sexy --fast

Two modifiers apply on top of whichever pool you choose. --volume-scaling makes light taps play quietly and hard slaps at full volume rather than one fixed level. --speed changes playback speed and pitch together, where 0.5 is half speed and 2.0 is double.

What this costs is flexibility after launch. No config file exists, so a pool is a process argument, and switching means editing the plist and reloading. --custom also hands a directory straight to the player, and nothing states which sample rates it expects or what happens when that directory is empty.

The fast profile raises the trigger bar while claiming more sensitivity

The tuning surface is two flags plus one profile. --min-amplitude is the trigger threshold in g-force and defaults to 0.05. Values around 0.05 to 0.10 register light taps, 0.15 to 0.30 are described as balanced, and 0.30 to 0.50 leave only strong impacts. --fast swaps four numbers at once: polling moves from 10ms to 4ms, the cooldown from 750ms to 350ms, the sample batch from 200 to 320, and the threshold from 0.05 to 0.18.

bash
sudo spank --min-amplitude 0.1   # more sensitive
sudo spank --min-amplitude 0.25  # less sensitive

Those two lines come from the example block itself, comments included. Read next to each other, the two sections disagree. The tuning paragraph presents 0.18 against 0.05 as higher sensitivity, while the sensitivity section says higher values let only strong impacts through. On paper --fast therefore raises the bar for what counts as a hit and shortens the wait between answers, which is fewer triggers rather than more. Settle that by trying both values on your own table instead of trusting either sentence.

--min-amplitude and --cooldown still override the profile, so you can move one number at a time. The same block also ends with sudo spank --sexy --min-amplitude carrying no value, which you have to supply.

The launchd plist starts spank as root at every boot

Running it at boot means a launchd daemon written straight to /Library/LaunchDaemons/com.taigrr.spank.plist. The pain mode version is printed in full and stops mid-key at the error log path:

bash
sudo tee /Library/LaunchDaemons/com.taigrr.spank.plist > /dev/null << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.taigrr.spank</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/spank</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/tmp/spank.log</string>
    <key>StandardErrorPath</key>
    <st

The three variants differ only in the ProgramArguments array, where sexy mode adds --sexy and halo mode adds --halo. Point that path at wherever the binary actually sits if it is not /usr/local/bin/spank. Then load it:

bash
sudo launchctl load /Library/LaunchDaemons/com.taigrr.spank.plist

Because the file sits in /Library/LaunchDaemons and sets no UserName key, launchd runs it as root, so the daemon itself needs no sudo. KeepAlive is true, so an exit is followed by a respawn rather than silence. The reversal is unloading the plist, not killing a process:

bash
sudo launchctl unload /Library/LaunchDaemons/com.taigrr.spank.plist

Two things to settle before leaving it installed. The printed snippets end mid-key, so you finish the StandardErrorPath line yourself and no log format is given. StandardOutPath points at /tmp/spank.log, a shared temporary directory that every local account can read.

No macOS floor, no per-user install, no scriptable trigger

Several limits are not visible in the flag list. There is no macOS version floor. The requirement is Apple Silicon, and no documentation states the oldest release that exposes the Apple SPU sensor through IOKit HID, so check a locked-down fleet image by hand before installing a root daemon on it.

There is also no way to trigger a clip without physical acceleration. No documented key, script, or network input feeds the detector, which means spank cannot serve as a notification sound for anything the machine already knows about. The tree does contain stdin_test.go, but no documentation describes standard input as a trigger path, so treat it as test scaffolding rather than a hidden feature.

There is no per-user install. Every example runs under sudo and the boot route is machine-wide, so scoping it to one account is your edit to the plist. And no config file exists: audio pool, threshold, cooldown, and both playback modifiers live in process arguments, so any change means unload, relaunch, reload.

The tree also carries flake.nix, flake.lock, a nix/ directory, .goreleaser.yaml, AGENTS.md, audio/, doc/, main.go, main_test.go and a Chinese README. None is documented as an entry point. The MIT licence lets you modify the clips and the detection code without extra terms.

Three tagged releases and a push on 2026-08-23

The release trail is short enough to read in full. v1.2.4 was published on 2026-03-08, v1.2.5 on 2026-03-27, and v1.3.0 on 2026-07-03. The repository is not archived, and its last push landed on 2026-10-23, after that release rather than with it.

No changelog sits among the top-level entries, and the README does not itemize what each tag changed, so the release pages are the only place to look before jumping versions. That matters more here than in most projects, because a KeepAlive daemon stays pinned to whatever binary you installed: an upgrade means unload, replace the file, load again. Nothing describes an automatic update path.

Practically, pin the version you test. Check that the flags you rely on, --min-amplitude and --cooldown most of all, still exist in the tag you move to, then reload the plist rather than editing it while the daemon holds the old path.

Editorial conclusion

spank fits someone with an M2 or newer MacBook, or an M1 Pro, who wants the machine to answer a slap and accepts running it as root. It is the wrong choice on Intel Macs, on base M1 and M1 Max hardware, and anywhere a physical impact is not how you want a sound triggered. Before installing, check the exact chip SKU, confirm that /usr/local/bin/spank resolves under sudo, and decide whether a boot-time daemon with KeepAlive true writing to /tmp/spank.log belongs on that machine.

Frequently asked questions

How do I install spank on a MacBook?

Download the binary from the latest release page, or run `go install github.com/taigrr/spank@latest` and copy the result with `sudo cp "$(go env GOPATH)/bin/spank" /usr/local/bin/spank`, because sudo does not look in ~/go/bin where go install puts it.

Which Macs can run spank?

macOS on Apple Silicon only, and the list is narrow: any M-series chip from M2 upward, or the M1 Pro SKU specifically, with no other M1 or A-series chips. Sensor access needs sudo, and compiling from source needs Go 1.26+.

How sensitive is spank by default, and what does --fast change?

The default trigger threshold is 0.05 g-force, low enough that light taps register. --fast moves polling from 10ms to 4ms, the cooldown from 750ms to 350ms, the sample batch from 200 to 320, and the threshold from 0.05 to 0.18, while --min-amplitude and --cooldown override individual values.

What plays when I run sudo spank and hit the laptop?

Pain mode, the default, picks at random from 10 pain or protest clips. --sexy escalates across 60 levels inside a rolling 5-minute window, --halo plays death sounds from the Halo games, and --custom plays MP3 files from a directory you name.

How do I stop spank from starting at every boot?

The daemon lives at /Library/LaunchDaemons/com.taigrr.spank.plist and runs as root because no UserName key is set. Run `sudo launchctl unload /Library/LaunchDaemons/com.taigrr.spank.plist`, since KeepAlive is true and killing the process alone would let launchd start it again.

Official sources

  1. Issues
  2. License: MIT
  3. README
  4. Releases
  5. taigrr/spank on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/taigrr-spank.svg)](https://hysenlabs.com/projects/taigrr-spank)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/taigrr-spank.svg)](https://hysenlabs.com/projects/taigrr-spank)

Was this useful?