← Course overview

Lesson 7 of 8 · 25 minutes

In this lesson

Open Weight Models · macOS · Lesson 7

Manage models, memory, and privacy

Inspect resource use, troubleshoot common problems, and keep local inference under your control.

macOS version. Use Terminal for terminal commands. The exercises and setup instructions below are tailored to this version.

What you will learn

  • Distinguish downloaded model files from models currently loaded in memory.
  • Investigate slow responses and common local service errors with a short, repeatable check.
  • Explain the local/cloud boundary and keep the unauthenticated local API on loopback.

Know what is stored and what is running

Use the model name and tag consistently. A downloaded model can remain on disk while no model is running. Conversely, finishing a chat does not necessarily unload its model immediately. Check the two states separately before trying to solve a storage or memory problem.

The following commands have different purposes. The remove command is a reference for deliberate cleanup after the course; do not run it as part of the observation exercise.

Know what is stored and what is running
CommandWhat it tells you or changes
ollama listList models available locally; ollama ls is an alias.
ollama psList currently loaded models, including their processor allocation.
ollama show gemma3:1bInspect this model's details.
ollama stop gemma3:1bUnload this model from memory without deleting its local copy.
ollama rm gemma3:1bDelete this local model copy. You may need to download it again to use that name.

Stop and remove solve different problems

Use stop when you want to release the model's runtime resources. Use rm only when you intend to remove a local model. Removing one name may not reclaim all shared model data used by another named model.

Observe performance on your Mac

The documented native Mac setup supports CPU/GPU execution on Apple M-series hardware and CPU-only execution on Intel x86. Inspect ollama ps during your own run rather than assuming a particular allocation or speed.

Open Activity Monitor and select Memory. Record the Memory Pressure graph and Swap Used while sending a short request, alongside the loaded-model information. These observations help describe the whole machine's workload; a process memory figure alone is not a universal model requirement.

Keep the model, prompt, context setting, and other open applications comparable when timing requests. A larger context consumes more memory, and the download size does not include all runtime needs. Use short notes at the exercise's chosen 4096-token setting before experimenting with more context.

  • Compare a first request after unloading with a second request using the same short prompt. Record both times; loading can make the first slower.
  • Keep the model, prompt, requested answer length, and other running tasks similar when comparing timings.
  • Record responsiveness and answer quality together. A faster incorrect response does not improve your study assistant.
  • If memory becomes constrained, close unnecessary applications, unload an unused model, and shorten the test before considering larger hardware or model changes.

Check the app, model, and resources in that order

Use one small known request to isolate the symptom. Keep the native app as your server owner, and check its most recent server log if the error needs more context. Review log excerpts for private information before sharing them.

Check the app, model, and resources in that order
SymptomMac-specific next step
ollama: command not foundOpen the installed app and check its CLI setup, then start a new Terminal window.
Connection refusedOpen Ollama from Applications and retry ollama list. A command being installed does not mean the app is running.
Port 11434 already in useTry ollama list: the native app may already own the port. Do not start another ollama serve process. If the check fails, investigate the process using the port rather than stopping unrelated apps.
Model not foundCompare the exact name/tag with ollama list. For cybercorps-study, confirm the create step completed from the project folder.
Slow request or memory failureInspect ollama ps and Activity Monitor. Close unused applications, unload unused models, and shorten the request before increasing the timeout or context.
Python cannot open a fileReturn to ~/CyberCorps/open-weight-models and check the exact .py filename; this error happens before an Ollama request.

macOS Terminal: inspect recent app-server messages · bash

tail -n 80 ~/.ollama/logs/server.log

Keep the Mac app local and verify its setting

Use the downloaded course model and keep the default loopback service. The local API requires no authentication; this course does not require sharing it with a network. A localhost request can still use a cloud model when configured to do so, so also check the selected model.

To disable Ollama cloud models and web search for the app, run the launchctl command below, fully quit Ollama, then reopen it from Applications. Closing only the chat window is not the same as quitting. After reopening, inspect the current startup log for Ollama cloud disabled: true.

launchctl sets the environment for subsequently launched processes in your login environment; it does not alter an already-running server. Do not treat this one-time command as permanent configuration. Recheck the setting and current startup log after signing out or restarting, and reapply it when needed.

Keep using the native app for these steps. A separately launched foreground server has its own environment and terminal logs. Disabling cloud features is not a firewall: software downloads, updates, your saved files, and other applications still have their own data handling.

Step 1 — set the environment for the next app launch · bash

launchctl setenv OLLAMA_NO_CLOUD 1

Step 3 — after fully quitting and reopening Ollama, inspect the new startup log · bash

tail -n 80 ~/.ollama/logs/server.log

Verify the server, not just the command

The command finishing successfully is not the final check. Look for the cloud-disabled message from the current app startup. If it is absent, record the uncertainty and investigate before claiming the setting is active.

Put it into practice

Create a local operation checklist

  1. With the native app running, record ollama list and ollama show gemma3:1b.

  2. Send a short request, inspect ollama ps, and observe Memory Pressure and Swap Used in Activity Monitor. Record observations rather than guessing a hardware requirement.

  3. After the request finishes, stop gemma3:1b and compare the loaded list with the downloaded inventory.

  4. Time two comparable short requests, noting the possible reload on the first. Keep the settings and other applications comparable.

  5. If enabling local-only mode, set OLLAMA_NO_CLOUD through launchctl, fully quit and reopen the app, and record the current startup log's verification result.

  6. Write your first Mac-specific check for a connection failure, an occupied port, and a missing model. Leave model deletion as a separate optional cleanup choice.

You have completed this task when…

  • Your evidence distinguishes disk availability from a model loaded in memory.
  • You have observations from your own machine and a practical first check for three common errors.
  • Your checklist distinguishes local inference from cloud routing and keeps the unauthenticated API on loopback.

Official documentation

Use these references for platform requirements, current options, and further detail.

Check your understanding

Choose an answer for each question, then check your reasoning.

1. You want to release a loaded model's memory while keeping it for tomorrow. Which command fits?
2. A program calls localhost:11434. What else must you check before describing its inference as local?

Answer each question to continue.