2

When I try to record audio from the command line with programs such as SoX or FFmpeg it doesn't record anything and ends up with a flat-line recording. I am guessing this is due to privacy restrictions from macOS Mojave/Catalina. This is similar to the issue Audacity is having, in which the fix is opening it from the terminal to trigger a request for microphone permissions.

This answer suggests granting Terminal access to the microphone from System Preferences. However, it will only show up in the list if Terminal requests it. So is there a way to grant an application unrequested permissions?

I also saw that Apple tech support have said non-GUI apps can't access the mic. Does this mean command line audio recording is completely broken? As it seemed to work perfectly on previous versions, could there be a fix for it like there is for Audacity?

3
  • 1
    I don’t know (yet) a way of preemptively adding devices/applications accessibility permissions. However, as for the the “Apple tech support answer...”. They are completely wrong: apple.stackexchange.com/a/326390/119271
    – Allan
    Commented May 12, 2020 at 17:53
  • Thanks, I have found a way to trigger the mic request for Terminal now! It is the exact same solution as the Audacity fix on Catalina - I just didn't think it would work for me because the Audacity fix didn't even work for me for some reason. Commented May 13, 2020 at 21:38
  • 1
    Post it as an answer! I’ll upvote so you can get the credit for the work!
    – Allan
    Commented May 13, 2020 at 21:40

1 Answer 1

1

If Terminal isn't showing up in the System Preferences list for microphone permissions, open it by:

open /System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal

Then run a program that uses the mic e.g.

sox -d -d 

(Note, sox is not pre-installed.) This will let you hear your mic input.

That should trigger it to request. If that didn't work try running the command on a different command line e.g. iTerm2. This is a problem and solution similar to the one for Audacity on Catalina. I'm not sure what the exact cause is though.

2
  • 1
    Nice! Glad you got it working! +1
    – Allan
    Commented May 13, 2020 at 23:01
  • 1
    Thanks! I’m a new user here and I’ve been seeing you around a lot, you’re a legend! Commented May 13, 2020 at 23:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .