Automatically eject USB disks after Time Machine backup completes.
Launches when a USB disk is inserted and exits after Time Machine completes.
To avoid:
Quickly install via yonaskolb/Mint – A package manager that installs and runs Swift command line tool packages.
brew install mint
mint run BrianHenryIE/UnmountVolumeAfterTimeMachine
mint uninstall BrianHenryIE/UnmountVolumeAfterTimeMachine
Originally requested as a feature for nielsmouthaan/ejectify-macos but not implemented in that now-archived project.
Uses BrianHenryIE/SwiftTimeMachine and BrianHenryIE/BHSwiftOSLogStream to parse Time Machine logs and query tmutil
for status. When the backup job completes, the disk is ejected with DADiskUnmount
.
TODO:
App should run when disk plugged in / Time Machine starts and quit when the disk is ejectedemorydunn/LaunchAgentWhen the app launches upon a disk being inserted, it should exit quickly if the disk is not used for Time Machine- What happens the app tries to unmount after Time Machine but other files are being copied in Finder?
- Disks should be re-mounted as per the Time Machine schedule
- Some sort of UI/checkbox to enable/disable/communicate the app is present and running apple/swift-argument-parser
- Notifications when the disk is ejected
Make available via brew- Currently, a race condition is possible that would cause the app to exit after another disk was unmounted (tiny window, fraction of a second)
- Check is the app already running
Build and run
swift build -c release
./.build/release/UnmountVolumeAfterTimeMachine