How to Convert Text to Speech Using Say in Mac Terminal
Discover how to use the Mac Terminal's say command to convert text to speech with customizable voice, speed, and automation options.
You often find yourself needing to listen to written content rather than read it, whether to reduce eye strain or multitask efficiently. Using the Mac Terminal's 'say' command offers a straightforward way to convert text to speech without relying on third-party apps.
This article explains how to convert text to speech with say in Mac Terminal, focusing on practical examples and customization options. You will learn how to adjust voice, speed, and pitch, work with text files, and automate the process through scripting to enhance productivity.
Key takeaways
- The basic 'say' command reads aloud any text you provide directly in Terminal.
- You can customize voice selection using the '-v' flag with available system voices.
- Control speech rate and pitch with '-r' and other options for clearer output.
- Input text from files or pipe commands for versatile usage.
- Create scripts or aliases to automate frequent text-to-speech tasks efficiently.
Before you start: What you need to use the say command
The say command is included by default on all macOS systems, so you don’t need to install any additional software to use it. This built-in tool lets you convert text to speech directly from the Terminal.
While basic familiarity with the Terminal can help you navigate and input commands efficiently, it’s not strictly necessary to get started with say. The command is straightforward and user-friendly for beginners.
Make sure your Mac’s sound output is working and not muted. You can check this by clicking the sound icon in the menu bar or by opening System Settings > Sound. Confirm that output is set to the correct device (e.g., internal speakers or external headphones) and that volume is at an audible level.
- Open the Terminal app from Applications > Utilities.
- Type
which sayand press Enter. - If the Terminal returns a path like
/usr/bin/say, the command is available on your system.
These steps ensure your environment is ready for using the say command effectively.
Basic usage of the say command to convert text to speech
The say command lets you quickly convert text to audible speech directly from the Mac Terminal. To read a short phrase aloud, type say "Your text here". For example, say "Hello, welcome to your Mac Terminal" will play the spoken phrase through your sound output.
When your text contains special characters or quotes, use backslashes to escape them, such as say "She said, \"Hello!\"". This ensures the command interprets the input correctly.
By default, say plays the speech immediately. To save the spoken output as an audio file instead, use the -o flag followed by the desired file name and format. For example, say -o greeting.aiff "Hello, saved audio!" creates an AIFF file. Typical audio files range from a few hundred kilobytes to a couple of megabytes depending on length and format.
- Open Terminal and enter
say "This is a test". You should hear the phrase played aloud. - Try escaping quotes:
say "He said, \"Testing quotes\""to confirm correct playback. - Save speech to a file with
say -o test.aiff "Audio file created". Check your current directory for the AIFF file. - Play the saved file using any compatible media player to verify the audio content.
Customizing voice, speed, and pitch with say
You can tailor the speech output of the say command to better suit your accessibility needs or preferences by adjusting its voice, speaking rate, and pitch.

- List available voices: In the Terminal, type
say -v?and press Enter. This displays a list of voices installed on your Mac, including accents and languages such as Alex (default American English), Samantha, Daniel, and Moira. Each entry shows the voice name and language code. - Set a voice: Use
say -v VoiceName "Your text here"to use a specific voice. For example,say -v Samantha "Hello world"speaks with the Samantha voice. - Adjust speaking rate: Control speed with the
-rflag, specifying words per minute. The default is around 175 wpm. For slower speech, trysay -r 100 "Text", or faster withsay -r 250 "Text". Higher speeds reduce naturalness and clarity, so balance speed with comprehension. - Modify pitch and other characteristics: macOS’s native say command has limited direct pitch controls. However, you can influence pitch indirectly by choosing different voices, some of which sound higher or lower. For advanced pitch control, consider combining say with audio processing tools.
| Voice | Sample Command |
|---|---|
| Alex (default) | say -v Alex "Welcome to Mac Terminal" |
| Samantha | say -v Samantha "Welcome to Mac Terminal" |
| Daniel (British English) | say -v Daniel "Welcome to Mac Terminal" |
Experiment with different voices and speaking rates to find a combination that suits your use case. Remember, faster rates can save time but might reduce clarity, while slower rates enhance understanding but take longer.
Using say with text files and piping input
To convert longer texts or entire documents, you can feed text files directly into the say command using input redirection or pipes. This method avoids typing large blocks of text manually and streamlines the process.
- Open Terminal.
- Use input redirection to read a text file and convert it to speech by entering:
say < filename.txt
You should hear the contents of filename.txt spoken aloud. - Alternatively, use a pipe with cat for the same result:
cat filename.txt | say
This also outputs the file’s text as speech. - To save the spoken audio for later use, add the -o option with a filename:
say -f filename.txt -o output.aiff
This creates an AIFF audio file of the spoken text. - Play back the audio file using QuickTime Player or afplay output.aiff in Terminal to verify the output.
You can combine say with other Terminal commands for automation, such as scripting text collection from logs or emails before conversion. Note that extremely large files might cause delays or truncation; breaking text into smaller chunks can help maintain smooth operation.
Example Terminal session:
- say -f example.txt -o example.aiff: converts example.txt to speech saved as example.aiff.
- afplay example.aiff: plays back the saved audio file.
Automating text-to-speech with scripts and aliases
You can streamline your use of the say command by creating simple shell scripts that include your preferred voices, speeds, or input sources. For example, a script named reminder.sh might contain:

- #!/bin/bash
- say -v Alex -r 180 "Time to take a break and stretch!"
Running this script will speak the reminder using the Alex voice at a faster rate.
To make frequent commands easier, define aliases in your shell configuration file like .zshrc or .bash_profile. For instance:
- alias saylog='tail -n 10 /var/log/system.log | say -v Samantha'
This alias reads the last 10 lines of the system log aloud with the Samantha voice when you type saylog.
You can also schedule speech notifications using cron or macOS’s launchd. For example, a cron job can run a script every hour to announce calendar events or reminders. While setting up these schedulers requires editing configuration files, they enable hands-free alerts directly from your Terminal.
These automation techniques help you integrate text-to-speech into workflows, notifications, and scripts, saving time and enhancing accessibility.
Troubleshooting common say command issues
If you run the say command but hear no sound, first check your Mac's sound output settings in System Preferences > Sound. Ensure the correct output device is selected and volume is not muted. Running say "test" should produce audible speech.
Permission errors like "say: command not found" or "Permission denied" indicate path or access problems. Verify you are using the Terminal with appropriate privileges and that /usr/bin/say exists by typing which say. If missing, macOS might have issues requiring a system update or repair.
Unsupported characters or encoding issues in text files may cause the voice to skip or produce errors. Confirm your text files use UTF-8 encoding. Use file -I filename.txt to check encoding, and convert with iconv -f old-encoding -t utf-8 filename.txt -o newfile.txt if needed.
If audio files created with say -o do not play or are corrupted, try using a different file extension such as .aiff or verify the file with afplay filename.aiff. Corruption may result from interrupted command execution or insufficient disk space.
Voice errors like "Voice not found" or "Invalid voice name" occur when specifying voices with -v incorrectly. List all available voices using say -v "?" and select one exactly as shown, respecting case sensitivity.
- How to Convert Audio with afconvert in Mac Terminal: Step-by-Step Guide
- How to Install Oh My Zsh in Mac Terminal: A Clear Step-by-Step Guide
Frequently asked questions
Can I use the say command to convert text to MP3 files?
The say command does not directly export audio to MP3 format. It can save speech output as an AIFF file using the -o option. To get an MP3, you need to convert the AIFF file using a tool like ffmpeg or an audio converter app.
How do I list all available voices for the say command?
Use the command say -v? in Terminal to see a list of all installed voices along with their language and gender. This allows you to choose a specific voice for your text-to-speech tasks.
Is it possible to control speech speed and pitch with say?
You can control speech speed with the -r option, which sets the words-per-minute rate. Adjusting pitch directly is not supported by say, but some voices have distinct tonal qualities that may affect perceived pitch.
What should I do if the say command produces no sound?
First, check your Mac’s volume and sound output settings to ensure audio is not muted or routed incorrectly. Also, verify that the selected voice is available by listing voices with say -v?. Restarting the Terminal or your Mac can resolve temporary issues.
What this guide does not cover and when to choose other tools
The say command uses macOS’s built-in voices and does not support third-party or downloadable voices directly, limiting the variety of speech options available. Advanced speech synthesis features such as SSML (Speech Synthesis Markup Language), neural voices, or emotional inflections are not accessible through the say command. Additionally, this guide does not cover graphical user interface (GUI) based text-to-speech tools or third-party applications that might offer more customization or integration options.
If you require highly natural or expressive speech, integration with other software, or more voice options, exploring dedicated text-to-speech applications or APIs would be advisable.
To build on what you’ve learned here, try creating a simple shell script that uses say with custom voices and speed settings for notifications or reminders. Automating this process via aliases or cron jobs can streamline your workflow and make text-to-speech a seamless part of your Mac Terminal experience.