Use voice commands on your Mac just like in Westworld

If you’ve watched Westworld, you should be familiar with the voice commands Westworld’s staff uses on the hosts. I wondered if I can remotely lock my MacBook as well, using just my voice. I hardly deliver my commands with Anthony Hopkin’s gravity, but I can now say “Okay, that’s enough” from across the room and my computer will lock… just like that!

We’re going to use two tools already built in Mac OS X: Automator and Dictation.

First we need to figure out a wake word for our computer. This is similar to “OK Google”, “Alexa” or “Hey Siri” found on handheld or home automation devices.

In this example, I’ll just use “Okay” as the wake word — but I really suggest against it. You don’t want your computer listening for commands (and perhaps misinterpreting some) every time someone says “OK”.

Open System Preferences and head to Keyboard → Dictation and Enable Dictation as well as the “Use enhanced dictation” option. If it’s the first you use dictation, there might be some waiting time while it downloads the files for offline dictation.

Head to Accessibility in System Preferences and scroll down to Dictation. Enable and choose a dictation keyword phrase.

Accessibility Settings, Dictation

You’re all set up. Now open and Create New Project. Select “Dictation Command” as the project type. - New dictation command
Type in the voice command you’d like to program and enable it. There’s a plethora of actions you can easily program from here, but you can also run terminal commands to change system settings (read on for examples).

Sample Automator Dictation Command

In my example, I programmed “That’s enough now” to start the screensaver. I’ve already configured my computer to require a password immediately after sleep or screensaver under Security & Privacy settings.

"Set yourself back online", Elsie and Maeve in Westworld

But you can create any kind of voice commands. To turn on or off your WiFi,  use the “Run Shell Script” action with:

networksetup -setairportpower airport off

Or perhaps you want to use Siri hands-free, without pressing any keys.

open /Applications/

And if you want your computer to talk without emotional display and adopt a placid demeanour, then just use the built-in voice synth using:

say "These violent delights have violent endings."

That’s enough, for now.