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:
- Use your voice to trigger a shortcut
- Send the task to Ollama
- Return just the AppleScript
- 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 llama3
(Or any model you like โ 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 ๐
- Go to System Settings > Accessibility > Voice Control
- Turn it ON
- Click Commandsโฆ
- Click โ to create a new command:
-
When I say:
Hey Mac
- While using: Any app
- Perform: Run Shortcut โ Select your shortcut (e.g., "AutoLama")
-
When I say:
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
- Receive:
tell application "Finder"
make new folder at desktop with properties {name:"LlamaMagic"}
end tell
- Run it instantly!
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! ๐ฌ๐
Top comments (3)
Can it be run in a sandbox?
no ,its for mac computer only
It sounds interesting. Are you planning to open-source the project?