I am aware of the afplay command to play an audio file. When I do that it plays through the current selected Sound Output. If I have my headphones in, it plays on the headphones. How can I specify that the sound plays over the Built-In Speakers?

In the Sounds System Preferences you can select the Alerts tab and direct the output of the Alert to a specific output. I am looking to do the same but with my own customs sounds triggered by the command line.


1 Answer 1


If you are looking for your computer to play sounds or words you can use the "say" command on the terminal. Just type

say dog

and the computer responds with dog over whatever speakers you have chosen from the Sound selection under system preferences. Go to system preferences and choose the Sound icon. When that opens you can select options for what plays the sound on your computer. One option is the internal speakers.

  • Thanks, in my scenario I have the Sound Output selected to my headphones but for just the command line I want it to always come through the built-in speakers. Nov 26, 2019 at 20:20

You must log in to answer this question.

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