Sunday, August 19, 2012

No Sound After Suspend/Sleep Mode Mac OS X

The Problem

So this problem has been a thorn in my side for months now. It's really annoying because the only way you can get your sound back is with a full reboot. No one was to be preempted with a reluctant reboot every time they put their computer to sleep, so enough already! It took me a while to find possible solutions to this problem but after some persistent googling, I was able to track down a helpful post on the Apple Support forum. There are a few recommended solutions I was able to glean from the thread.

 1. Disk Utility's Repair Disk Permissions feature

This post explains this feature. I've included a screenshot below of the app (Applications/Utilities/Disk Utility.app).





























I don't know if this really helps, but I did it anyway and it definitely doesn't hurt. I'd recommend this one as some permissions are bound to be out of synch and who knows what side affects they could be causing.

2. Plug Headphones In/Out

Sounds like a hack, right? Well apparently this has worked for some people but it's certainly not a long term solution. Put in your favorite earbuds, take them back out, and be blessed with audio. I've yet to try this technique as I find success via the command line but feel free to cross your fingers and give it a shot.

3. Uninstall Parallels Desktop

"Not I said the cat". 

I don't know how feasible this one is but someone managed to link the problem to Parallels Desktop. If you've ever saw one of my screencasts you'll know that's virtualization software for Windows and other operating systems. I'm not planning to uninstall software I payed 100 bucks for, but if you want your audio back and have some other VM you can run then knock yourself out.

4. Restore your OS

This isn't particular good but assuming you have a TimeMachine backup or fully backed up image on hand then I guess it's not too bad. If you've got the time to spare then a clean restore could turn out to pay dividends. I don't think I'll be doing this until my Lion is old, immobile, and children have graduated to the big leagues capable of hunting on their own and tracking down their own prey. I do have backups in place but I'd rather not have to make use of them anytime soon.

5. Reset Permissions on coreaudiod.plist

These are permissions related to the coreaudio daemon process that's spawned by the OS. This can be accomplished with a simple command line.

sudo chown root:wheel /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist

I tried navigating to that path in my shell but it didn't resolve. Maybe it's under a different alias in later versions of Mac. If you're able to locate it then good luck.

6. Set KeepAlive to "True" in coreaudiod.plist

This involves editing the contents of "com.apple.audio.coreaudiod.plist"

<key>KeepAlive</key>
       <true/>

7. Kill/Restart the coreaudio daemon

This one worked for me!!

Simply execute this command from your shell.

sudo kill -9 `ps ax|grep 'coreaudio[a-z]' |awk '{print $1}'`

I've created a script with the contents of the command and placed it in "/usr/local/bin". Make sure that location is included in your path. After creating the file, be sure to make it executable with

chmod 755 <whatever_you_named_the_script>

What you may notice after executing this command is that the OS was queueing up all your audio  requests in the background. You'll here it flushing it's internal buffer and your speakers getting flooded with audio from the moment your computer was summoned from sleep mode up until the time you restarted the coreaudio daemon. So if you pressed the volume button 12 times, you'll here 12 little "pops" synchronously pumped out of your speakers. It's like cleansing your system after years of build up. It all just comes out at once. Hehe :)

The End

I'll admit that none of the solutions are particularly "clean", but they're better than having to use preferences to increase your volume and being robbed of the spoils of devices like Apple Remote. Apple is undoubtedly long overdue for a patch as this seems to have been a problem for at least over a year now. I hope one of these tips works for you, and as always, feel free to refer directly to the forums for additional help, additional clarity, or any solution I may have failed to extract and make known.

2 comments:

  1. Hi. How did you do the script you mentioned at point 7. With Apple Script Editor?

    Thanks

    ReplyDelete
  2. It's bash. Also, this works 'better': sudo killall -9 -u _coreaudiod

    ReplyDelete