HydraKiller is a lightweight macOS application bundle and daemon wrapper
designed to mitigate runaway Apple system daemons (photoanalysisd,
mediaanalysisd, and photolibraryd) on macOS Monterey 12.0 and later.
These background processes frequently trigger a cascading bug that forces the
macOS "Shared with You" "Syndication" database write-ahead log
(Photos.sqlite-wal) to grow unchecked, wasting significant CPU cycles and
consuming hundreds of gigabytes of disk space until the hard drive is completely
full.
Because launchd aggressively restarts these daemons like a replicating hydra, this project uses a C99 application shim to cleanly disable the daemons, wait out their file locks, and truncate the runaway SQLite database safely under full Transparency, Consent, and Control (TCC) authorization.
In other words... It kills Apple's hydra and saves your CPU & disk! ππ‘
Standard background scripts run via launchd trigger strict macOS TCC security
blocks when attempting to access user Photos libraries. HydraKiller solves this
by packaging a POSIX-compliant shell script inside a native compiled macOS App
Bundle container. Thus, it can be run within the inherited permissions context
from the App bundle.
HydraKiller.app: A signable C99 application binary wrapper that resolves its own bundle paths and executes the embedded shell script payload viaexecv.truncate_syndication_wal.sh: The underlying POSIX script that sequentially disables and kills the daemons, monitors file locks vialsofto prevent database corruption, and safely truncates the write-ahead log.- Launch Agent: Automates execution on a periodic background interval
(e.g., hourly).
- On macOS Monterey:
com.lyraphase.HydraKillerLauncher.truncatesyndication.plistβ A native userLaunchAgentthat uses the olderProgramandProgramArgumentsplistkeys, for macOS 12.x compatibility - On macOS Ventura or later:
com.lyraphase.HydraKillerLauncher.plistβ A native bundledLaunchAgentthat usesBundleProgramplistkey to launch the embedded shim and script. This makes it possible for theHydraKillerLauncher.appto register theLaunchAgentwith Apple'sSMAppServiceAPI.
- On macOS Monterey:
TODO! I don't have an Apple Developer account, which requires $$, time, and possibly more entitlements & code signing debugging.
-
Open the project in Xcode. Ensure your target type is a macOS App Template named
HydraKillerLauncher. -
Compile the project (
Product->Build For->Running) or press β+Shift+R. -
Find the built App (
Product->Show Build Folder in Finder) -
Move the compiled App package to your
/Applicationsfolder. Drag and drop theHydraKillerLauncher.app, OR run:cp -R /path/to/built/HydraKillerLauncher.app ~/Applications
Run the HydraKillerLauncher.app once to trigger registering the LaunchAgent.
Copy the com.lyraphase.HydraKillerLauncher.truncatesyndication.plist
configuration file into your user LaunchAgents folder:
cp HydraKillerLauncher/com.lyraphase.HydraKillerLauncher.truncatesyndication.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.lyraphase.HydraKillerLauncher.truncatesyndication.plist
In case the Photos library permissions were not enough, you can enable Full Disk Access to workaround issues with Apple's app sandbox permissions.
Because the app relies on a compiled app bundle rather than a raw terminal script, this allows it to be whitelisted natively in macOS System Settings:
- Navigate to
System Settings->Privacy & Security->Full Disk Access. - Click the
+(Plus) button. - Locate
/Applications/HydraKillerLauncher.appand add it to the list. - Toggle the permission switch next to it to
On.
To run manual mitigation immediately at any time:
launchctl start com.lyraphase.HydraKillerLauncher
To run manual mitigation immediately at any time:
launchctl start com.lyraphase.HydraKillerLauncher.truncatesyndication
launchctl print gui/$(id -u)/com.lyraphase.HydraKillerLauncher
launchctl print gui/$(id -u)/com.lyraphase.HydraKillerLauncher.truncatesyndication
This project is open-source software licensed under the GNU Affero General Public License v3.0 (AGPLv3).
See LICENSE