Pages

Muting the Startup Tone in OSX

This is a hack that I have found infinitely useful due to the amount of annoyance it saves. No one appreciates the person who comes to a lecture (maybe a few minutes late), opens their MacBook, hits the power button, and treats everyone to the Mac startup tone at full volume. This method ensures this will never happen again. Sadly, I do not remember now where I first read it as it was some years ago.

The idea is to create two scripts, one that mutes and one that unmutes: When the Mac is shut down, one script mutes the system so that the next startup will not produce the tone and the second script unmutes the system at login (following the usual occurrence of the tone, which happens at startup but before login) so that the system functions as normal.

Below, the contents of mute-on.sh
#!/bin/bash
osascript -e 'set volume with output muted'

Below, the contents of mute-off.sh
#!/bin/bash
osascript -e 'set volume without output muted'

Put these two scripts in a location of your choosing and run the following to create the appropriate Login Hooks
sudo chmod u+x /Library/Scripts/mute-on.sh
sudo chmod u+x /Library/Scripts/mute-off.sh
sudo defaults write com.apple.loginwindow LogoutHook /Library/Scripts/mute-on.sh
sudo defaults write com.apple.loginwindow LoginHook /Library/Scripts/mute-off.sh

To remove the Login Hooks so you can hear the login tone again
sudo defaults delete com.apple.loginwindow LoginHook
sudo defaults delete com.apple.loginwindow LogoutHook

One deficiency with this hack that I've noticed is that when one uses the headphone jack and shuts down the system with the plug still in the jack (removing the plug after shutdown) sometimes the next startup will produce the hated tone. This effect is rare enough though (I do not think it happens every time) that I have not bothered to try and find a further solution.