Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mute the startup sound using a logout hook System
First write a small script:

#!/bin/tcsh -f
 osascript -e 'set volume 0'
I named mine mute.sh and saved it to /usr/local/bin/. Next, make it executable:
sudo chmod u+x /usr/local/bin/mute.sh
Add it as a logout hook using the defaults write command:
sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/mute.sh
And last, make a small AppleScript with Script Editor to set the sound back to a normal level when the user logs back in.
set volume 3
Save it as a run-only application, and add it to your login items. Restart and listen to the startup sound, because you won't have to hear it again.
    •    
  • Currently 3.14 / 5
  You rated: 4 / 5 (7 votes cast)
 
[51,082 views]  

Mute the startup sound using a logout hook | 28 comments | Create New Account
Click here to return to the 'Mute the startup sound using a logout hook' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mute the startup sound using a logout hook
Authored by: nickfitz on Oct 08, '03 11:02:43AM

My PowerMac G4 keeps on muting the startup sound. Sometimes it goes really low but at present it's totally silent. I haven't got the faintest idea what may be causing this; anybody got any ideas? The desktop volume control retains its settings OK.

If I reset the parameter RAM, the sound comes back, but it usually goes again within a few weeks.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: mousee on Oct 09, '03 12:22:11AM

I have exactly the same problem with my iMac G3 400 DVSE. The startup sound may disappear for a few weeks and come back one day. No clues about what's happening. My PowerBook G4 onthe other hand is OK.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: david-bo on Oct 08, '03 11:48:19AM

Are there any other hooks available? Sleep?

Btw, where do you find these hooks?

---
http://www.google.com/search?as_q=%22Authored+by%3A+david-bo%22&num=10&hl=en&ie=ISO-8859-1&btnG=



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: extra88 on Oct 08, '03 12:39:34PM
"Logout hooks" are just Login Items that run at logout instead of login. There's no GUI for setting programs to run at logout so you have to resort to console commands like this one

sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/mute.sh

The muting magic it being done by using AppleScript to set the volume. According to a recent O'Reilly article, there's no direct AppleScript control for Sleep but they provide a script using AppleScript GUI Scripting (basically a script which uses an application's menus , buttons, etc.) You could probably create this sleep script and set a logout hook to run it so every time you log off, the computer goes to sleep.

[ Reply to This | # ]

Mute the startup sound using a logout hook
Authored by: Eravau on Oct 08, '03 01:40:51PM
I may be wrong, but I think david-bo was asking if there are any other hooks you can use besides ones that are caught at Logout. For example, could you set a hook to run certain things when you tell the computer to go to sleep (or startup or shutdown, etc.). For Example:

sudo defaults write com.apple.loginwindow SleepHook /usr/local/bin/do_sleep_stuff.sh

If there are other hooks available, what are they?

[ Reply to This | # ]

logout hooks
Authored by: matx666 on Oct 08, '03 01:50:19PM

check out bombich.com and his loginwindow manager

http://www.bombich.com/software/lwm.html

and his hooks

http://www.bombich.com/mactips/loginhooks.html

-x



[ Reply to This | # ]
running scripts on sleep / wake
Authored by: miggins on Oct 09, '03 12:39:21AM

try using sleepwatcher from http://home.t-online.de/home/bernhard.baehr/



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: MVasilakis on Oct 27, '03 09:50:14AM

Could we make a logout directory and hook to that directory?

sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/logout/*



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: kirbysdl on Feb 05, '04 03:46:40PM
I don't think that would work, but you can have your logouthook script run everything in a given directory...
for i in /some/directory/* ; do
  if [ -x "$i" ]; then
    . $i
  fi
done
Keep in mind that all of the executable scripts in the targetted directory will be run as root, so be careful who can write into this directory and know what's inside.

[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: Wayne_S on Oct 08, '03 02:02:53PM
Maybe I am too cautious, but the startup chime is the machine's way of telling you it has passed the POST (Power-On Self Test). The alternative sound for failing the POST (at least under OS 9 - I haven't experienced it under OS X) was an evil-sounding 4 tone sequence followed by the display of the "Sad Mac" icon at startup. In case you've never seen it, the Sad Mac was a classic Mac with X's for eyes and a big frown.

I like the reassurance of knowing my Mac is functioning properly from the moment the power switch is hit.

[ Reply to This | # ]

Mute the startup sound using a logout hook
Authored by: RandyMan on Oct 08, '03 05:06:55PM

Seems to me you'd know pretty quickly whether you passed the POST or not, with or without the startup sound...



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: georgemp on Oct 09, '03 02:43:48AM

It helps in troubleshooting. Different startup sounds could have different meanings. Crasghing glass means failed RAM. I've had this before and it was easy to determine what was wrong because of that. There are a couple of other sounds too with special meanings. A search on Apple's kbase would list them.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: helicine on Oct 08, '03 05:55:45PM

i know the sound is nice to know that some things are working okay - but this is great for people who share laptops - especially w/ students or those who use their laptops in lots of meetings (etc.) where laptop sounds are not appreciated



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: poultryfarm on Oct 08, '03 06:05:00PM
great hint. 2 thoughts:
sudo defaults write com.apple.loginwindow LogoutHook /usr/local/bin/mute.sh
this writes the change to /private/var/root/Library/Preferences/com.apple.loginwindow.plist
if it were instead written to the users com.apple.loginwindow.plist file
~/Library/Preferences/com.apple.loginwindow.plist
would this instead implement this only on a per user basis? that would be nice.

also instead of writing an applescript to 'unmute' the sound couldn't you just write a loginhook? is the code for that just 'LoginHook' instead of 'LogoutHook'?

[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: poultryfarm on Oct 08, '03 08:25:07PM

well couldn't get the loginhook to unmute the volume, even when i tried something like the script below to not 'mute' the sound but make it inaudible:
osascript -e 'set volume .03'



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: kirbysdl on Feb 05, '04 03:41:03PM
I thought I was having the same problem, but it turns out that volume level 5 is the second lowest effective volume setting. Everything between 0 and 4 inclusive turn off the sound (at least for this particular Powerbook).

So try set volume 5. That's what I did for my loginhook and it works.

[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: Pat-B on Apr 29, '04 09:50:41AM

I've noticed that if you're using fast user switching, and you log out of an account, let the account do it's 120 second countdown and switch to another account while the countdown is still running, your volume will be reduced to 0.

It took me a while to figure this out, as I would be listening to my music and suddenly the music would go silent.



[ Reply to This | # ]
Easier way
Authored by: Manic Velocity on Oct 08, '03 06:32:09PM

Not sure if this works on every machine, but it works on my flat screen iMac and 12" iBook.

I just hold the "Mute" button on the keyboard before I push the power button, and voila, no startup sound.

This helps when I'm powering up my iBook in class and don't want to disturb the teacher or other students.



[ Reply to This | # ]
Re: Easier way
Authored by: masjones on Oct 08, '03 11:28:46PM

I like hearing the startup chime, its kind of reassuring..... at any rate it sure is better than that godawful Windows sound :)

On my 12" Powerbook if the sound is muted when I shut down it restarts in that same state. The sound doesn't come back until I turn it back on.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: cybergoober on Oct 09, '03 11:48:09AM
I may give this one a shot. My PM G4 MDD Dual 867 has this annoying habit of making the Startup Chime at MAX volume, no matter what the volume is set to in any given user on the system (or even if it's a single user setup). Thanks for the hintů

[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: loekjehe on Oct 09, '03 01:48:23PM

This doesn't work on my G4 2x533 MHz. I have the startup sound always MAX and this is a nuisance. I tried everything to change this (also this hint) without any success. After changing the sound having boot in OS 9 it is OK for one time, but then after starting up in X it is on MAX again. Any suggestions?



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: Christoph on Sep 07, '06 05:33:03AM
Note that set volume 0 has not the same effect as pressing the mute button, but as lowering the sound volume down to zero. If you want that OSX remembers your previous sound level, use instead

osascript -e 'set volume output muted true'


[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: trosberg on Jul 16, '07 01:31:01AM

The method described does not work on this iMac G5 2.1 GHz, Mac OS X 10.4.9, with two sound out devices (internal and USB).

The startup chime is not altered by setting output volume, and is played every time through internal.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: trosberg on Jul 16, '07 02:14:42AM

An explanation for the above mentioned: There seems to be kind of minimum volume for startup chime in iMac G5 2.1 GHz. No audible difference between 'set volume 1' and 'set volume 2', which is still quite loud. Mute works, though. So my only possibility is mute internal speakers in System Preferences or via this hint.

A freeware control panel 'StartupSound' does the same, too, and is not capable to set volume lower than 'set volume 2'. Using System Preferences is enough. I mute internal speakers that play startup chime, and set volume of USB audio device for apropriate listening experience.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: bnj on Nov 09, '07 08:20:18AM

Hi.
This trick worked great for a little while. Now, I have upgraded to leopard and it does not work anymore. Therefore, I would like to remove this logout hook.

Does anybody know how to remove it?

Thank you.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: pauldacheez on Oct 11, '08 07:06:29AM

FYI, installing Leopard probably removed it due to it being in /usr/bin. Redo the hint and you'll have it back.



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: koit on Jun 14, '09 10:47:41AM

I got rid of the startup sound using the following:

1. Login as administrator and open a terminal window

2. Create scriptfile for muting
sudo nano /path/to/mute-on.sh

3. Enter this as content, when done press control+O to save and control+X to exit:
#!/bin/bash
osascript -e 'set volume with output muted'

4. Create scriptfile for unmuting
sudo nano /path/to/mute-off.sh

5. Enter this as content, when done press control+O to save and control+X to exit:
#!/bin/bash
osascript -e 'set volume without output muted'

6. Make both files executable:
chmod u+x /path/to/mute-on.sh
chmod u+x /path/to/mute-off.sh

7. Check if any hooks already exist (these will be overwritten, so make sure it is OK for you)
sudo defaults read com.apple.loginwindow LoginHook
sudo defaults read com.apple.loginwindow LogoutHook

8. Add hooks for muting
sudo defaults write com.apple.loginwindow LogoutHook /path/to/mute-on.sh
sudo defaults write com.apple.loginwindow LoginHook /path/to/mute-off.sh

Notes:
- /path/to/ is the location of the scripts, I used /Library/Scripts/
- you can skip the unmuting loginhook (i.e. each logout will silence your machine), but I like it this way because I always have sound available exactly at the volume level I set last time
- root has to be the owner of the script files - running an editor from command line with sudo is the easiest way to achieve that (otherwise you need to chown)
- to delete the hooks, use the following:
sudo defaults delete com.apple.loginwindow LoginHook
sudo defaults delete com.apple.loginwindow LogoutHook



[ Reply to This | # ]
Mute the startup sound using a logout hook
Authored by: jazzmac66 on Jun 13, '11 07:44:25AM
I made an installer from the last hints for easy install and uninstall the login/logout hook. Go here for download: http://www.casa-blu.de/casa-blu/Tools.html

[ Reply to This | # ]