Mute the Mac OS X startup sound, the fastest way

Copy/paste lines below and put in your password when prompted to disable OS X startup chime.

sudo sh -c "echo '#'"'!'"'/bin/sh\nosascript -e \"set volume without output muted\"'>/usr/local/bin/unmute"
sudo sh -c "echo '#'"'!'"'/bin/sh\nosascript -e \"set volume with output muted\"'>/usr/local/bin/mute"
sudo chmod a+x /usr/local/bin/mute /usr/local/bin/unmute
sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/unmute
sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/mute

This code will create two shell scripts, /usr/local/bin/unmute, /usr/local/bin/mute that will execute these AppleScripts:

set volume without output muted

and

set volume with output muted

After this, the code will bind those scripts to the LoginHook and LogoutHook handlers: when you will log out, sound will be muted, after you logged in, sound will be un-muted.

If you want to restore startup chime, type:

sudo defaults delete com.apple.loginwindow LoginHook
sudo defaults delete com.apple.loginwindow LogoutHook
sudo rm /usr/local/bin/mute /usr/local/bin/unmute

Something to add?

Be sure to let me know! I am @daw985 on Twitter.