Unleash Your Personal AI: Setting Up a Secure Ollama Server for Apple Shortcuts (MacOS + iOS)


⚡️ This article is part of my AI education series, where I simplify advanced AI concepts and strategies for nontechnical professionals. If you want to read more posts like this one, visit my AI Glossary via the button below to see the full resource list.


Ever dreamed of having a powerful AI assistant right at your fingertips, one that respects your privacy and runs on your own hardware?

Look no further!

This guide will walk you through setting up your very own Ollama AI server on MacOS, securely accessible from your iOS device through Shortcuts. Get ready to dive into the world of personal AI, network security, and automation!

IMPORTANT SECURITY DISCLAIMER: This guide demonstrates a basic setup for learning purposes. Running an open AI server on your network does pose security risks if done improperly or left publicly accessible without supervision. Do not leave this setup running long-term or on a public network. For a production environment, implement proper security measures like authentication and encryption. This tutorial is a barebones test case to show you how this works, so be sure to close things out properly when you are done with your test. :)

Why Ollama?

Ollama is an open-source project that lets you run large language models locally. It's like having your personal ChatGPT, but one that runs on your own hardware and respects your privacy.

Here's why you might want to set this up:

  1. Privacy: Your queries stay within your home network.

  2. Customization: Tailor the AI to your specific needs.

  3. Availability: No reliance on external services that might go down.

  4. Cost-effective: No subscription fees for AI services.

  5. Educational: Learn about AI, networking, and security.

For a deeper dive into Ollama, how it works, and why it’s useful to you as a professional, you can check out my Intro to Ollama.

Why Try This?

Do you want a powerful AI assistant that runs on your own hardware, respects your privacy, and is accessible right from your Apple devices? That's what we're setting up here!

This project is great for:

  1. Learning about AI and large language models

  2. Experimenting with local AI processing

  3. Understanding API interactions and iOS Shortcuts

What You'll Need

  • A Mac computer

  • An iPhone with iOS 14.0 or later

  • Both devices on the same Wi-Fi network

  • About 4GB of free storage on your Mac

Quick Setup Guide

1. Install Ollama on Your Mac

  1. Visit https://ollama.com

  2. Download and install Ollama for macOS

  3. Open Ollama from your Applications folder

2. Set Up Ollama

  1. Open Terminal (Applications > Utilities > Terminal)

  2. Pull the llama3.1 model:

    ollama pull llama3.1

  3. Start Ollama:

    ollama serve

    Keep this Terminal window open.

3. Find Your Mac's IP Address

  1. Go to System Preferences > Network

  2. Select your Wi-Fi connection

  3. Note the IP Address

4. Create Your iOS Shortcut

  1. Open Shortcuts app on your iPhone

  2. Create a new shortcut

  3. Add a "Get Contents of URL" action

  4. Configure it as follows:

    • URL: http://YOUR_MAC_IP:11434/api/generate (replace YOUR_MAC_IP with your Mac's IP)

    • Method: POST

    • Request Body: JSON

  5. Add these key-value pairs to the JSON:

    • model: Text, Value: llama3.1

    • system: Text, Value: [Your system prompt]

    • prompt: Text, Value: [User Prompt]

    • stream: Boolean, Value: False

      • This tells the model to simply write its full response before sending the output to you

  6. Add a "Get Dictionary from Input" action

  7. Add a "Get Value for 'response' in Dictionary" action

5. Run Your AI-Powered Shortcut

  1. Ensure your Mac and iPhone are on the same Wi-Fi network

  2. Run your newly created shortcut

  3. Watch as your personal AI assistant responds!

Cool Things to Try

  1. Create a writing assistant shortcut

  2. Build a code explanation tool

  3. Make a creative prompt generator

  4. Develop a quick ideation helper

Reminder

Remember, this setup is for short-term experimentation only.

To use Ollama securely in the long term, you'll need to implement proper network security measures.

Troubleshooting

  • If the shortcut fails, check that Ollama is running on your Mac

  • Ensure both devices are on the same network

  • Verify you're using the correct IP address in the shortcut

Happy experimenting with your personal AI assistant!

Shep Bryan

Shep Bryan is a revenue-driven technologist and a pioneering innovation leader. He coaches executives and organizations on AI acceleration and the future of work, and is focused on shaping the new paradigm of human-AI collaboration with agentic systems. Shep is an award-winning innovator and creative technologist who has led innovation consulting projects in AI, Metaverse, Web3 and more for billion / trillion dollar brands as well as Grammy-winning artists.

https://shepbryan.com
Previous
Previous

Introducing Ollama Shortcuts UI (OSUI) for Local AI Workflows on Macbook Pro

Next
Next

Judging the AITX Hackathon in Austin, Texas!