Talking Terminal: Have Your Mac Say Hello

Microphone with red background
A little Terminal trickery will have the Mac singing in no time.

 Darryn van der Walt / Getty Images

We have quite a few Terminal tricks we like to share with Mac users. Most provide clearly functional improvements to using the Mac. But sometimes, it's just time for a bit of fun, so with that in mind, we give you the Say command.

"Say" is a Terminal command that will speak anything you type after the command. You can try it out by launching Terminal, located at /Applications/Utilities, and then typing or copy/pasting the examples given here.

A simple example:

say hello

Will cause your Mac to speak the word hello.

You can also specify which voice your Mac should use when it speaks the say command by using the -v attribute. An example:

say -v fred hello

In this case, the voice named Fred will be used to speak the word hello.

The Mac's Many Voices

Your Mac has quite a few voices it can use for speech; currently, there are over 100 voices available in various languages and styles. If you would like to see a full list of the voices, here's how to do it:

  1. Launch System Preferences by clicking on its Dock icon, or selecting System Preferences from the Apple menu.

  2. Select the Dictation & Speech preference pane (in iOS X Lion, select the Speech preference pane).

  3. Select the Text to Speech tab.

  4. From the drop-down menu for System Voice, select Customize.

  5. A sheet will display all of the available voices your Mac can use.

  6. You will notice some voices have a checkmark next to them, while others have the checkbox blank. Those with a checkmark are displayed in the System Voice drop down menu.

  7. If you would like to try out the various voices, you can use the System Voice drop down menu to select a voice, and then click the Play button to hear the voice speak a sentence or two.

An alternate method to view all the available voices is to enter the following command in Terminal:

say -v ?

and then press the return or enter key.

Terminal will list all of the available voices.

When specifying a voice in Terminal, use all lower case. If the name has a space in it, such as Bad News, place it in quotes, like this.

say -v 'bad news' hello

Time for Terminal to Sing

Enough with the hellos; on to more fun. The Say command can speak a long sentence; in fact, it can say just about anything as long as it's on a single line. If you hit the return key, the command will be executed, so the easiest way to produce long speeches is to type them into a text editor first and then copy/paste them into Terminal. The Say command understands some punctuation, including the period and the comma, both of which inject a slight pause into speaking the text.

Now for the fun part. With the right combination of voice and words, you can get the Say command to sing.

say -v 'pipe organ' Dum dum dee dum dum dum dum dee Dum dum dee dum dum dum dum dee dum dee dum dum dum de dum dum dum dee dum dee dum dum dee dummmmmmmmmmmmmmmmm

There are actually a few different voices that can be used for singing, all of them in the Novelty section of the list that the Dictation & Speech preference pane produced in the example above.

For the most part, the ability of these voices to sing isn't in the text string you use but is actually built into the character of the voice. Here are some examples:

Hall of the Mountain King

The Cellos voice intonation is the Hall of the Mountain King. Give the following a try in Terminal:

say -v cellos Doo da doo da dum dee dee doodly doo dum dum dum doo da doo da doo da doo da doo dad doo da doo

You can actually use any text; the Cellos voice will try to render it in the form of the Hall of the Mountain King.

Pomp and Circumstance

Ready for a bit of pomp for graduation day? Try the following in Terminal:

say -v 'good news' di di di di di di di di di di di di di di di di di di di di di di di di di di di di

That's all the singing voices we have found in the Mac's many voices. But there are so many voices available, there may be more to find. Drop us a line if you find any additional singing Terminal voices.