Problem:
I would like to disable the start-up chime my OS X Mavericks-based Mac makes so that restarting the computer will not be so loud.
Notes:
- The solutions below were tested on OS X 10.9 Mavericks and may work on other versions, but there is no guarantee.
- This how-to was written as a reminder for myself in case this needs to be replicated or undone later. It is not a full solution and still a bit advanced for the average OS X user to follow, which makes it unacceptable to post as a "solution" (in my opinion).
- You're welcomed to follow the solutions below, but use the more permanent one at your own risk.
Solution 1 (temporary):
Turn the volume of your computer down before shutdown or restart. The start-up chime should match your system's volume.
Note that muting seems to have mixed reported results in forums and other online posts, where some systems will chime at the same volume as the system volume, even when muted (resulting in lots of surprise chimes), yet others report that muting works.
Solution 2 (advanced workaround, but a bit more permanent):
This solution goes through the steps to write a script that turns the system volume to 0, and rigs it to run upon the user selecting to shutdown or restart the machine via the apple menu.
Warnings:
- Make sure you are comfortable with Terminal, shell scripts, file permissions, and reading manual pages (if you get stuck). If you are not comfortable using Terminal (or are prone to making typos), you should probably not try this. Attempt at your own risk.
- Every time you start up OS X, the volume will be set to 0 (which may not be a bad thing if you're already trying to avoid surprises by turning the chime sound off to begin with)
This is a modification of the solution found here, but modified in a way that should work on more OS X setups. The modified steps are posted below as a reminder in case the link ever goes down.
Steps:
- Run the Terminal app with an administrator account
- Create a script for muting (replacing "/path/to/" with a valid path -- if you're not sure what this means, do not proceed with the rest of the steps)
sudo nano /path/to/volume-off.sh
- Write the volume-off script (or copy and paste the following into it):
#!/bin/bash osascript -e "set Volume 0"
- Make file executable with following command (replacing "/path/to/" with where the script is saved):
sudo chmod u+x /path/to/volume-off.sh
- Check that we can hook this to the OS X logout (see if any hooks exist - only one or none can exist, not more). In Terminal, use the command:
sudo defaults read com.apple.loginwindow LogoutHook
You should end up with something similar to "The domain/default pair of (com.apple.loginwindow, LogoutHook) does not exist".
- Add hook to run script at logout, replacing "/path/to/" with where the script is saved:
sudo defaults write com.apple.loginwindow LogoutHook /path/to/volume-off.sh
To Undo Solution 2:
- Check that the logout hook exists in Terminal with the following command:
sudo defaults read com.apple.loginwindow LogoutHook
You should end up with something similar to "/path/to/volume-off.sh" with "/path/to/" being where your script is saved.
- Delete the logout hook in Terminal with the following command:
sudo defaults delete com.apple.loginwindow LogoutHook
Notes on solution 2:
- Just like in the original solution, the volume-off.sh script is also saved in /Library/Scripts/
- Make sure the permissions of the script is set so that only the owner can write to the file, since the script is run as sudo (and would be an obvious security risk if it can be re-written by just anyone).
- The script must be owned by root.
- Again, this will turn the volume to 0 upon logout rather than simply mute. This is because many people online seem to report mixed success with muting.
- The commands for setting both a login and a logout hook, as well as removing them are as follows:
- sudo defaults write com.apple.loginwindow LoginHook /path/to/your-login-script.sh
- sudo defaults write com.apple.loginwindow LogoutHook /path/to/your-logout-script.sh
- sudo defaults delete com.apple.loginwindow LoginHook
- sudo defaults delete com.apple.loginwindow LogoutHook
- The commands for checking if a hook exists for login or logout are as follows:
- sudo defaults read com.apple.loginwindow LoginHook
- sudo defaults read com.apple.loginwindow LogoutHook
Very brief discussion on problems with other solutions found online:
The following will only make sense to anyone who has Googled how to disable the start-up Mac chime and read through the various proposed solutions. It briefly outlines why these workarounds weren't posted here. You can skip this section if you'd like.
nvram SystemAudioVolume method:
- too dangerous for most users (you can easily accidentally turn your computer into an expensive paperweight with the nvram command)
- many mixed results and uninformed posts online on why that solution used to work (read: everyone seems to be guessing. If you don't want to be one of those guessers, you can read up on nvram in the slightly out-of-date book "Mac OS X for Unix Geeks (Leopard)" in Google Books as that section appears to be viewable for free, at least as of January 2014)
- the solution doesn't work on all OS X and Mac combinations
- the solution does NOT work in Mavericks (tested) as the system will change the SystemAudioVolume value automatically
rc startup/shutdown script method:
- does not work in Mavericks as start-up has been moved to launchd instead (see Apple developer documentation on Launch Daemons and Agents
- any daemon-supporting mechanism may change in future versions of OS X, making this solution possibly unreliable (and worse, it will leave potentially unwanted files dangling deep within the system)
- this solution is way too complicated to post for the average user
existing software:
- many don't work on all versions of OS X (mixed results reported in forums, etc.)
- all software Googled do not describe exactly what system-wide changes are being made, making it hard to determine how permanent they are, as well as how well do they handle OS upgrades
- Mavericks seems to have broken a lot of the existing software, so it's hard to recommend a good one
the solution 2 in this blog post:
- it's not possible to do if you are not the system administrator
- it's not possible to do if you or your system administrator has already hooked something to com.apple.loginwindow LogoutHook
- it's possible that it won't work if you shut down your computer using a different mechanism than the usual Apple UI ways
- it's still inaccessible to most users
- if permissions are not set correctly, you could potentially create a security hole
an official Apple "turn off start-up sound" preferences item:
- does not exist/was eliminated
- if you're from Apple, perhaps you could help out with this? =)
References:
- http://my.opera.com/mereh/blog/2011/07/30/apple-osx-mute-startup-sound-chime-in-osx-10-7-lion-and-others?startidx=50#comments
- https://developer.apple.com/library/mac/documentation/darwin/reference/manpages/man8/nvram.8.html
- https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/StartupItems.html#//apple_ref/doc/uid/10000172i-SW9-CJBBHDII
- https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/defaults.1.html
- http://osxdaily.com/2007/04/28/change-the-system-volume-from-the-command-line/
- Other references seem to include a lot of guessing or solutions that did not work, so they have been omitted for now to avoid confusion
Hi, I would prefer following:
ReplyDelete1. Logout hook with: osascript -e 'set volume with output muted'
2. Login hook with: osascript -e 'set volume without output muted'
It will mute/unmute sound, so when User turn on mac, than sound level will be like when he turn off.
And yes, I just saw that You already mentioned mute/unmute, but there could be some issue with it! =)
ReplyDeleteHi and thanks for the comments @Janis Mezitis! Finding a solution to preserve the volume level is definitely something that I (and a lot of people out there) agree with you on =)
ReplyDeleteHey there, thanks for your How-To, wcdev. Unfortunately it doesn't seem to work on Mavericks using a dual-boot setup with the REFIND bootloader. The volume is set to zero but it does not have any effect on the startup chime. NinjaStart does not work with my system either. This is just a quick report by me. But thanks for your work nevertheless. Felix
ReplyDeleteHi @Felix, thanks for your comment! I'm certain that it will help someone out there (or myself if I ever try out the REFIND bootloader) :)
ReplyDeleteYou're welcome:) I have no idea why it wouldn't work though...
DeleteBTW what you have written about the nvram-method is exactly right from my perspective, it will be reset on Mavericks.