Macos – “reload” mac audio drivers without rebooting

audiodriversmacmacos

I have an external audio interface (M-audio fast track c400). In order to get my macbook to recognize it (display in audio/midi setup), I have to reboot, which is a hassle. I have had other m-audio interfaces that were automatically detected when connected, and I'm pretty sure this one should be the same. Most posts around the internet suggest updating the OS or the software/firmware for the device. I have done all of those with no luck. I am currently running OS X 10.8.5.

Is there a way to force OS X to reload the device? Preferably some command line voodoo that I could fire off quickly when needed or wrap up in a nice little shell script.

Edit: Progress..

The problem appears to be fixed now… I'm not sure how the following solved the problem. If you know, please comment!

Inspired by @sbugert's answer, I started looking into other system daemon's that might do the trick if restarted. As a shot in the dark I killed coreservicesd. This caused the OS to become visibly unstable and I was eventually logged out automatically. To my surprise, when I logged back in, my audio interface was recognized..

Based on that, I hypothesized that killing coreservicesd and logging out/in may be a possible (ugly) workaround. So I unplugged the interface and plugged it back in, and as expected, it was not recognized. So I killed coreservicesd and attempted to log out, however I could not get the system to log out due to the instability caused by killing coreservicesd. I eventually was forced to do a "hard" shutdown (i.e. holding the power button until it turns off). After booting up the macbook again, the interface is now recognized automatically every time I plug it in. I suspect that this "hard" reset may have solved the issue without all the shenanigans with the coreservices daemon, but I have no way to test that.

If anyone can shed light on this, please do!

Edit: It stopped working again so I don't know what's up.

Best Answer

EDIT: most likely only works for osx before 10.13

This is what you need,

sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext

But if you want to kill your coreaudio as well,

 ps aux | grep 'coreaudio[d]' | awk '{print $2}' | xargs sudo kill

use with caution.
The grep target is written this way specifically to exclude grepping the grep process itself in the ps out.

Related Question