-
-
Save jtorvald/fa2311e7ab933e6a84cce9654caa45c3 to your computer and use it in GitHub Desktop.
# if you don't understand how to save this file and execute it (open reset-audio.command) | |
# then copy and paste this oneliner and enter your password for privileged access: | |
# sudo kill -9 $(ps axc|awk "{if (\$5==\"coreaudiod\") print \$1}"); | |
# get the process ID of coreaudio | |
PID=$(ps axc|awk "{if (\$5==\"coreaudiod\") print \$1}") | |
if [ $PID != "" ] | |
then | |
echo "Killing coreaudiod process on $PID" | |
# Killing the audio daemon ( don't worry: MacOS will bring it back up ) | |
if sudo kill -9 $PID; then | |
echo "Done. Audio should be fine" | |
else | |
echo "That didn't work..." | |
fi | |
else | |
echo "CoreAudio not running?" | |
fi | |
@Viamusic1000 because I had some crappy noise coming out of my speakers and tried to kill the coreaudiod to see if it worked since they said it’sa software issue. The result was that it solved the noise instantly. Of course it’s not a permanent fix, but I didn’t have the issue since. When it happens again I just run the command again until Apple comes with a real patch.
@Viamusic1000 because I had some crappy noise coming out of my speakers and tried to kill the coreaudiod to see if it worked since they said it’sa software issue. The result was that it solved the noise instantly. Of course it’s not a permanent fix, but I didn’t have the issue since. When it happens again I just run the command again until Apple comes with a real patch.
How do I know this won't break anything? I do work with audio and music notation so this bothers me sometimes.
@Viamusic1000 well I don't give guarantees because I don't want to be sued for anything. ;-) But I'm 99.9999% sure that this won't break anything. It looks more dangerous than it is. Ending (a.k.a. Killing) a process on a operating system is quite common. It's like restarting your MacBook, it ends the running processes and reboots your computer. Only now you just end the process while you don't restart. And MacOS finds the coreaudiod process important enough to restart it itself directly when it ends. I ran this command more than 10 times while testing my script and all is good. No worries! If you have your audio crackling and popping just try it and see if it helps you.
@Viamusic1000 well I don't give guarantees because I don't want to be sued for anything. ;-) But I'm 99.9999% sure that this won't break anything. It looks more dangerous than it is. Ending (a.k.a. Killing) a process on a operating system is quite common. It's like restarting your MacBook, it ends the running processes and reboots your computer. Only now you just end the process while you don't restart. And MacOS finds the coreaudiod process important enough to restart it itself directly when it ends. I ran this command more than 10 times while testing my script and all is good. No worries! If you have your audio crackling and popping just try it and see if it helps you.
Should I download the script and run it as a text file or what? I copy and pasted in it terminal but Im not sure it did anything in the system and didn't do anything with the speaker for sure.
@Viamusic1000 Try this:
- Copy this text: sudo kill -9 $(ps axc|awk "{if ($5=="coreaudiod") print $1}");
- CMD + Space to open Spotlight search.
- Type: Terminal (You will see a black Icon in front of the word: Terminal) press ENTER
- Press CMD+V to paste this into the terminal (or right mouse button + paste)
- Press Enter
- It will ask for your MacBook password to execute this command as admin. Enter the password and press ENTER
You should now hear a pause in audio and your audio volume reset to 50%
I got an error that said:
awk: syntax error at source line 1
context is
{if >>> (== <<<
awk: illegal statement at source line 1
awk: illegal statement at source line 1
@Viamusic1000 something went wrong here in the comments. The backslashes \ were stripped. Hope this helps:
sudo kill -9 $(ps axc|awk "{if (\$5==\"coreaudiod\") print \$1}");
@Viamusic1000 too bad! Hope that Apple soon comes with a fix because it's an annoying bug to have for such an expensive device.
How do you know this works?