Skip to content

Instantly share code, notes, and snippets.



Last active Jun 12, 2019
What would you like to do?
How to make your Mac talk from your iPhone

How to make your Mac talk on it's own (Sort Of)

Recently I've gotten into automating everything with Siri's new shortcuts. They're pretty powerful and allow for a lot of neat scripting. One of the more exciting features is the ability to run a script over SSH while I've been playing around with automating a ton of things around my house with this. I've come across something pretty fun.

In all recent Version of MacOS have this command called say say will read out whatever the command arguments are. If you open a terminal on your Mac and type something like say "hello world" your Mac will read it back to you.

The best part of this is that you don't have to be logged in for this to work, the Mac just has to be on. Combining this with a Wake on LAN function could be pretty powerful (and annoying)

While this is a cool feature, it doesn't have much practical use, and I'll probably use it to screw with my roommates.

What you'll need

  • An iDevice running iOS 12 or later
  • A Mac running OSX Lion or later (This has been around for a while)
  • Some way to connect directly to your Mac over the network. This is all done over SSH, so there needs to be some way for your phone to connect directly to your Mac. On a local network, this is no problem. If you want to do this from far away, you'll need to figure that out on your own (exposing port 22 to your Mac is not a good idea)

Figure out the local ip of your machine

Figuring out the ip of the machine is reletivley simple. Open a terminal type ifconfig Find the entry with an ip address after inet (en0 for me)

My internal IP is

Enable SSH

To check if SSH is already enabled run sudo systemsetup -getremotelogin

To enable SSH run sudo systemsetup -setremotelogin on

If you one day want to turn it off run sudo systemsetup -setremotelogin off

Set up the Shortcut on your phone

The shortcut is minimal. It only consists of 2 blocks, one getting the input and then the other sending the message

First, from the scripting tab, add a "Ask for Input" block, type in what the prompt should be on your phone.

Make sure to keep the type as "Text"

Second, also from the scripting tab, add a "Run script over SSH" block.

Add your IP to the host, keep the port the same, and type in your user login for the user and password. The input should automatically have the input from the "Ask for input block"

in the "Script" section put say " and then add the input variable bar above the keyboard, tap the "as Alarm" and change it to "as Text". Tap done. Then complete the quotes "

When finished, it should look like this:

Tap done, give it a name, and give it a whirl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment