Skip to content

A lightweight macOS menu bar app that prevents dangerous volume spikes when Bluetooth audio devices connect.

License

Notifications You must be signed in to change notification settings

adairrr/macos-volume-guard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VolumeGuard

A lightweight macOS menu bar app that prevents dangerous volume spikes when Bluetooth audio devices connect.

macOS 13+ Swift 5.9 License

⚠️ Development Status: This project is in active development. It works and has been verified on macOS 26.2 (Tahoe), but has not been tested on other macOS versions. Use at your own discretion.

The Problem

macOS has a long-standing bug (documented since 2009, still present in macOS Sequoia) where Bluetooth headphones sometimes connect at maximum volume, causing painful audio blasts. This has been reported across:

  • AirPods (all generations)
  • AirPods Pro
  • AirPods Max
  • Sony WH-1000XM series
  • Bose headphones
  • Various other Bluetooth audio devices

Users have reported volume spikes reaching 122 decibels — well above safe listening levels.

Bug Reports & Discussions

Apple Community Forums:

MacRumors Forums:

Other Resources:

The Solution

VolumeGuard monitors your audio devices using Apple's official CoreAudio APIs and instantly enforces volume limits:

  • ~15-30ms response time — Volume is capped before you hear the full blast
  • Per-device limits — Different limits for different headphones
  • Persistent settings — Remembers your limits across restarts
  • Zero friction — Menu bar app, launches at login, just works

Features

  • 🎧 Per-device volume limits — Set different max volumes for each audio device
  • Instant enforcement — Limits applied within milliseconds of any volume change
  • 🔊 Real-time monitoring — See current volume and limit in the menu bar popover
  • 💾 Persistent configuration — Settings saved automatically
  • 🚀 Launch at login — Start automatically with your Mac
  • 🎯 Bluetooth-focused — Auto-enables limiting for Bluetooth devices

Screenshots

Click the menu bar icon to see your devices and adjust limits:

Menu Bar Popover Settings Window
Current device with volume bar and limit slider General, Devices, and About tabs

Installation

From Source

This project uses xcodegen to generate the Xcode project file.

Prerequisites:

  • macOS 13.0 (Ventura) or later
  • Xcode 15.0+
  • xcodegen (brew install xcodegen)

Steps:

  1. Clone this repository:

    git clone https://github.com/yourusername/VolumeGuard.git
    cd VolumeGuard
  2. Generate the Xcode project:

    xcodegen generate
  3. Open and run in Xcode:

    open VolumeGuard.xcodeproj

    Then press ⌘R to build and run.

Or build entirely from the command line:

xcodegen generate
xcodebuild -scheme VolumeGuard -configuration Release build
open ~/Library/Developer/Xcode/DerivedData/VolumeGuard-*/Build/Products/Release/VolumeGuard.app

To install permanently, copy the built app to your Applications folder.

Note: Since the app is not signed with an Apple Developer ID, macOS Gatekeeper will block it on first launch. To open:

  1. Right-click the app → Open → click Open in the dialog, OR
  2. Go to System Settings → Privacy & Security and click Open Anyway

This only needs to be done once. The app does not expire.

Usage

  1. Launch VolumeGuard — A speaker icon appears in your menu bar
  2. Click the icon — See your current audio device and volume
  3. Adjust the limit slider — Set your maximum volume (default: 70%)
  4. Enable "Launch at login" — In Settings, enable auto-start

When volume exceeds your limit, VolumeGuard instantly resets it. You might hear a brief blip of loud audio (~15-30ms) before it's corrected.

How It Works

VolumeGuard uses Apple's CoreAudio Hardware Abstraction Layer (HAL) APIs to:

  1. Monitor device changes — Detects when Bluetooth headphones connect
  2. Monitor volume changes — Receives instant callbacks when volume changes
  3. Enforce limits — Programmatically resets volume when it exceeds your limit

All using official, documented Apple APIs — no hacks, no kernel extensions, no admin privileges required.

Related Projects

Other projects addressing this issue:

  • save-my-ears — Launch agent to reset volume on headphone connection
  • PurrfectVolume — AppleScript-based volume limiter
  • Bluesnooze — Prevents Mac from connecting to Bluetooth while sleeping

Commercial alternatives:

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

License

MIT License — See LICENSE for details.

Acknowledgments

  • Built with guidance from Apple's Core Audio Documentation
  • Inspired by the long-suffering macOS users who have dealt with this bug for 15+ years

About

A lightweight macOS menu bar app that prevents dangerous volume spikes when Bluetooth audio devices connect.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •