1 Building Your Own AI — Getting Started
This opening chapter introduces the goal of the book: building a private, voice-enabled AI chat application that runs entirely on a Mac. The finished app will let you speak into a microphone, transcribe your words locally, send the text to a local large language model, and stream the AI’s response back in a browser-based chat interface. The project uses a Mac-first toolchain built around macOS, Terminal, Homebrew, VS Code, Python, Ollama, MLX Whisper, and Streamlit, with Python chosen because it is practical, beginner-friendly, and well supported in the local AI ecosystem.
The chapter explains why local AI is valuable, especially for privacy, voice privacy, freedom from subscriptions or changing cloud service rules, and deeper technical understanding. It contrasts local AI with cloud AI: cloud systems often provide the most powerful and current models, while local systems keep data on your machine, work offline, avoid ongoing fees, and give you more control. It also introduces large language models as systems trained on huge amounts of text that generate responses by predicting likely next words, while noting that they can produce confident but inaccurate answers. The required hardware and software are outlined as well, with Apple Silicon Macs preferred for performance, though Intel Macs can still be used with limitations.
The chapter then shifts from concepts to preparation by introducing the terminal as the essential interface for installing tools, running Python scripts, starting Ollama, and launching the final web app. It explains the difference between graphical interfaces and command-line interfaces, why developers rely on the command line for speed, precision, automation, portability, and AI-agent workflows, and how to open and customize Terminal on macOS. Finally, it teaches safe foundational commands for navigating and organizing files: pwd to show the current location, ls to list files, cd to move between folders, mkdir to create folders, and clear to clean the display. The chapter emphasizes that these basics are safe, error messages are normal feedback, and command-line confidence is the first practical step toward building the local AI application.
Cloud AI (right) sends your prompt across the internet to a hosted inference service, and your data may be stored on the company's servers. Local AI (left) keeps the prompt, the model, and the response inside your machine -- no network hop, no external server, no data leaving your control.
Overview of the voice chat application. Your Mac runs three pieces locally: a Streamlit web app in the browser captures your voice and renders the chat, MLX Whisper transcribes your speech to text, and Ollama runs the LLM that generates the streaming reply. The dashed boundary marks "your machine" -- nothing crosses it.
The GUI and the CLI offer different features, but both communicate with the computer's operating system. Clicking in the GUI and typing in the CLI ultimately reach the same destination.
Exercises
- Navigate your home directory. Open the terminal and use pwd to confirm you are in your home directory. Use ls to see all your folders. Navigate into Documents using cd Documents, list its contents, and return home using cd ~.
- Create a project structure. Starting from your home directory, create the following folder structure using only mkdir and cd:
- After creating each folder, use pwd to verify your location and ls to confirm the folder was created.
- Explore hidden files. Run ls -la in your home directory. Count how many hidden files and folders (those starting with .) you see. Pick one and guess what it might be for.
- Speed comparison. Time yourself performing these tasks, first using Finder, then using the terminal:
- Navigate to your Documents folder
- Create a new folder called test_folder
- Go inside the new folder
- Go back to your home directory
- Practice `clear` and `cd`. Navigate to three different folders (Desktop, Documents, Downloads), run ls in each one, then use clear to clean the screen. Finally, return home with cd ~ and run pwd to confirm.
- Reflect on your AI use. Think about the last three times you used a cloud AI service (ChatGPT, Gemini, Claude, or similar). For each interaction, consider: Did it contain private information? Did you need an internet connection? Could a local model have handled the task? Write down your answers. You will revisit this reflection after completing Chapter 4.
Build Applications with Local AI Models on a Mac ebook for free