How to make your Mac talk

How to make your Mac talk

10.01.2020 - Written by

Ever wondered how to make funny stuff with macbook? Yes? Cool, this article may be for you. It will be easy and extends your skill beyond all those office people, who know how to open internet browser at maximum. Ready? Let’s get started!

No programming required

In the past, I got an funny idea of what my mac could do. But I had no clue how to make it happen. All that programming stuff on the internet seemed kind a large topic to learn, especially if you would like to try just few innocent jokes on your friends macbook… **imagine evil laughter here**!

But I will disappoint you in one thing… programming is not needed, but some scripting is. What is scripting? It is easy set of commands which your mac understand, and it will execute them if you command him to.

Mac Terminal

In order to start, please search for “Terminal” among your applications. Terminal is installed on every mac, so no worries, you do not have to install anything new!

Tip: You can search for Terminal using Launchpad. Launchpad can be displayed by clicking icon at the bottom bar or by pressing F4 key.

Searching for Terminal App at Launchpad

If your terminal is successfully opened, you should see a new window like this:

Successfully opened Terminal window as user named Jim

As you can notice, you can type text inside… cool! Now we are ready to make some funny stuff!

Making Mac talk

In Mac, things are working as following… you type command, and then press enter. So now, make sure your sound is turned on. Then type into terminal following command:

say "Hello"

Instead Hello you can write whatever you want. Just keep in mind, quotes are very recommended to use (without them, you can’t use space in your word). Done it?

Congratulations… you made your mac to tell first word!

Speech must contain more words

Now we can make mac say one word. But how to make multiple words? It is easy. Just write more say command more times, but separate them by semicolon:

say "Hello!"; say "Jim is funny"

You can type any words you want to be said. However notice one unpleasant thing – So far we have a chatterbox which is talking endlessly without stop. This may be a little annoying and unnatural. Let’s make our talking mac more person-like.

A Gentleman knows when to be silent

We all have friend that talks endlessly, all the time, like our talking mac. If we want to make him to behave more like human, he should be silent sometimes, and have propper pauses between sentences he is saying.

Luckily for us there is a command called sleep. The only thing it does, is waiting. And this will be handy as we will show later. You can try to type following command into your Terminal screen and then press enter.

sleep 5

You can notice, the only thing that happened is that our command made mac to wait for 5 seconds before you could execute another command. Using sleep 3 would make pause for 3 seconds and so on. Why is this useful to us?

Yes, you guessed correctly – we can use sleep command to make pauses between our words. So let’s try merge all this together.

Putting our knowledge together

So imagine this… your friend is going away from his mac, but he keeps him turned on. You type some fancy stuff meanwhile, and when he will go back, his mac is suddenly talking with him. How to make this? How to make mac tell something we shown earlier, the only thing now is set propper timing!

Lets say, your friend will be back from lunch after 20 seconds. You can launch following command on his computer:

sleep 20; say "Hello"; sleep 3; say "Are you listening to me?"

When your friends went back, his mac will greet him “Hello”… meanwhile he will be thinking silently “What the hell is happening…???”. Then after 3 seconds mac will ask “Are you listening to me?”. At this moment your friends starts to be confused, and things get funny.

Tip: If you want to be stealthy, you can make Terminal window to be closed while your commands are being executed. Just put all your commands in brackets with ampersand at the end:

(sleep 20; say "Hello"; sleep 3; say "Are you listening to me?") &

Notice when you do this, you can immediately close Terminal window, and mac will be talking anyway! Please use this responsibly and smart. Do not trick people into thinking they got computer virus on their mac or something similar, as you can get into problems with law or to pay financial fines.