Is there a way to play OSX alert sounds from terminal? The alert sounds that are listed in System Preferences > Sound > Sound Effect Tab


If you have "audible bell" enabled in your Terminal Settings under Advanced, BEL control characters will sound the default alert sound.

To try this, issue the echo command followed by control+v control+g. If you type it right, it will look like this:

$ echo ^G

and when you press return, the alert will sound.

(control+v is a shell escape for the immediately-following control character.)

The afplay command can also be used to play a specific sound file:

$ afplay /System/Library/Sounds/Funk.aiff 
  • I use this for playing sounds in MAMP PRO: <? passthru('/usr/bin/afplay /System/Library/Sounds/Sosumi.aiff'); ?> – EDP Dec 17 '17 at 13:42

Another option, with less modifier keys, is to use the command tput bel.

  • I liked this answer because I disabled the "audible bell" in my terminal settings, but tput bel calls the "visual bell" so I still get the alert that I want without the noisy one – Purefan Jan 26 '16 at 9:22

Another way to beep is echo -e '\a'

You must log in to answer this question.

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