How to record audio from terminal in macOS Mojave?
They have restricted access to the microphone from the terminal by default after the update. 

You need to go to System Preferences > Security &amp; Privacy > Privacy > Microphone and tick the box for the terminal and it should all work again.