Interacting with Siri via the command line in macOS

I was wanting the same feature today - I got it working but could be improved upon: https://youtu.be/VRLGCRrReog

TLDR is use LoopBack by Rogue Amoeba and change Siri’s input Mic to Loopback. Then Use the Say command in Terminal for example.


As mentioned by Brad Parks, you can enable 'Type to Siri' from the Accessibility menu. You can use this to interact with Siri using simulated keypresses.

I've created a simple Python script which behaves like requested in your question when invoked from the command line.

The script uses the keyboard Python module.

#!/usr/bin/python
import sys
import time
import keyboard

def trigger_siri():
    keyboard.press('command+space')
    time.sleep(0.3)
    keyboard.release('command+space')
    time.sleep(0.2)  # Wait for Siri to load

if __name__=='__main__':
    trigger_siri()
    keyboard.write(sys.argv[1])
    keyboard.send('enter')

This isnt from the command line, but closer... and I haven't tested it, but in High Sierra there's a way to use Accessibility settings to enable you to use your keyboard to ask Siri questions.

How to enable it:

  • System Preferences > Accessibility > Siri.
  • Click in the box beside Enable Type to Siri so that a tick appears.
  • Now when you trigger Siri, a keyboard will appear into which you can type your query.

Snagged from here: https://www.macworld.co.uk/news/mac-software/how-use-siri-on-mac-3536158/