Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to play a short sound file from the command line in Mac OS X, independent of any audio player application, in order to provide notification that a long job has finished.

share|improve this question
up vote 24 down vote accepted

There is a built-in tool: afplay <sound file>. The man page does not document all of its options, which can be found via afplay -h:

afplay [option...] audio_file

Options: (may appear before or after arguments)
  {-v | --volume} VOLUME
    set the volume for playback of the file
  {-h | --help}
    print help
  { --leaks}
    run leaks analysis
  {-t | --time} TIME
    play for TIME seconds
  {-r | --rate} RATE
    play at playback rate
  {-q | --rQuality} QUALITY
    set the quality used for rate-scaled playback (default is 0 - low quality, 1 - high quality)
  {-d | --debug}
    debug print output

It will not play more than one audio file.

share|improve this answer
afplay sometimes has this bug:… . Are there any alternatives? – tog22 Jan 13 '15 at 12:48
Careful with the -v option: a value of 1 seems to mean "100%"! – doctaphred Apr 8 at 17:52

One time, when the power went off at work, knowing that my firewall would return to that last state (powered on) when the electricty came back on, I wrote a script in bash that used the say command to wake me up when the power came back on.

share|improve this answer
I love abusing the say command. – NReilingh Jun 16 '11 at 21:17
Indeed, say is relevant to this sort of problem and a good alternate solution. Have a vote! I was looking specifically for playing a short sound, though, as hearing a phrase would get tiresome for my use case. – Kevin Reid Jun 18 '11 at 4:58

Have you considered printf "\a\a\a" or echo -e "\a\a\a"?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.