Macos – Play sound on mac terminal


I have a script running in the background and sends me an alert every few minutes. I want the alert to be in the form of a beep.

Question: How can I play a beep in mac terminal?

Best Answer

printf \\a and osascript -e beep play the default alert sound, but they are silent if the alert volume is set to zero. printf \\a is also silent if an audible bell is disabled.

You could also use afplay or say:

afplay /System/Library/Sounds/Funk.aiff
say done

There are more sound effect files in /System/Library/PrivateFrameworks/ScreenReader.framework/Versions/A/Resources/Sounds/.

Related Question