How I Built a Local AI Task Agent with Ollama + Apple Shortcuts + Voice Control (Hey Mac! ๐Ÿš€)

siri vs ollama

Sure! Here's a fun, friendly, and easy-to-understand blog post just for you ๐Ÿ˜„โœ๏ธ.


๐Ÿง  How I Built a Local AI Task Agent with Ollama + Apple Shortcuts + Voice Control (Hey Mac! ๐Ÿš€)

Hey there, fellow tech explorer! ๐Ÿ‘‹ Ever wished your Mac could just listen and do what you ask? Like:

"Hey Mac, generate an AppleScript for me!"

Well guess what? You can make that happen โ€” without any cloud magic. It's all local, private, and totally in your control ๐Ÿ˜Ž

Let me walk you through how I created a simple AI agent using:

  • ๐Ÿฆ™ Ollama (running AI models locally)
  • ๐Ÿ Apple Shortcuts (automation awesomeness)
  • ๐Ÿ—ฃ๏ธ Voice Control (so I can just speak commands)
  • ๐ŸŽฉ Custom phrase: โ€œHey Mac!โ€

๐ŸŽฏ What Weโ€™re Gonna Build

"Hey Mac, write an AppleScript to mute the volume."

This command will:

  1. Use your voice to trigger a shortcut
  2. Send the task to Ollama
  3. Return just the AppleScript
  4. Run it automatically!

Boom. Magic. ๐Ÿ”ฎโœจ


๐Ÿ› ๏ธ Step-by-Step Guide

1๏ธโƒฃ Install Ollama & Run a Model Locally

Go to ollama.com and install it.

Then, open Terminal and run:

ollama run gemma3:latest

(Or any model you like โ€” Gemma 3,Mistral, Llama 2, etc.)

Itโ€™ll start a local API at:
๐Ÿ“ http://localhost:11434/api/generate

2๏ธโƒฃ Create the Shortcut in Apple Shortcuts

Hereโ€™s what the shortcut does (you saw this in the screenshot):

  • ๐ŸŽ™๏ธ Dictate Text โ€“ You speak the task
  • ๐Ÿ“ Sends: "Return only valid AppleScript code. Do not explain. The task is: <your task>"
  • ๐ŸŒ GET request to: http://localhost:11434/api/generate
  • ๐Ÿช„ Extracts the pure AppleScript (removes backticks and tags)
  • ๐Ÿ–ฅ๏ธ Runs it using osascript
  • โœ… Done!

3๏ธโƒฃ Connect Voice Control with Custom Command

Hereโ€™s the cherry on top ๐Ÿ’

  1. Go to System Settings > Accessibility > Voice Control
  2. Turn it ON
  3. Click Commandsโ€ฆ
  4. Click โž• to create a new command:
    • When I say: Hey Mac
    • While using: Any app
    • Perform: Run Shortcut โ†’ Select your shortcut (e.g., "AutoLama")

Here is the screenshot of the shortcut i made

{
  "model": "gemma3:latest",

  "messages": [
    {
      "role": "system",
      "content": "you are a apple script writer you can write for mac terminal with osascript -e and code only no more extra text"
    },
    {
      "role": "user", 
      "content": "Dictated Text"
    }
  ],
  "stream": false }

POST request data for ollama api/chat

Replace gemma3:latest into your model

Now say:

"Hey Mac"
It triggers your shortcut ๐ŸŽค๐Ÿค–

๐Ÿ˜ Example in Action

Letโ€™s say I want to create a new folder on my Desktop. I say:

โ€œHey Mac, create a folder named LlamaMagic on desktop.โ€

Your shortcut will:

  • Send that to the local LLM
  • Run it instantly!

Receive:

tell application "Finder"
    make new folder at desktop with properties {name:"LlamaMagic"}
end tell

You just spoke an idea and your Mac obeyed like a friendly genie ๐Ÿงžโ€โ™‚๏ธ


๐Ÿง  Bonus Tips

  • You can change the prompt to ask for shell scripts, Python, or whatever!
  • Add more automation, like asking for confirmation before running
  • Use clipboard instead of voice if you're shy ๐Ÿ˜…

๐Ÿฅณ Final Thoughts

This was super fun to build, and it makes your Mac feel like a personal AI assistant. Everything is local โ€” no internet, no tracking, no middleman!

All you need is:

  • Ollama ๐Ÿฆ™
  • A Shortcut โšก
  • Voice Control ๐ŸŽ™๏ธ
  • A little creativity ๐Ÿ’ก

Now go impress your friends and make your Mac say "Your wish is my command." ๐Ÿ˜„


If you liked this guide, share it with your geeky friends ๐Ÿง™โ€โ™€๏ธ and tell them:

โ€œYou donโ€™t need Siri. You need Shortcuts + Ollama!โ€

Need help setting it up? Drop your questions below! ๐Ÿ’ฌ๐Ÿ‘‡

Read more