I am developing an app which needs to have exclusive access to the USB sound device. I found out that when the music is playing using this device then sometimes it is not possible to get access. So I need to stop and restart CoreAudio daemon.
I am using this piece of code (below) to get it work. But the problem is that after coreaudiod is stopped I can run it only under root user. By default it is ran under _coreaudiod user. How can I run it under _coreaudiod user as it's done by the OS?