AskHandle

AskHandle Blog

How to Run Llama 3 on Mac: A Step-by-Step Guide

July 25, 2025Aria Singh3 min read
  • Llama 3
  • LLM
  • AI

How to Run Llama 3 on Mac: A Step-by-Step Guide

Llama is a series of advanced artificial intelligence models developed by Meta. In this tutorial, I will guide you through the process of running Meta Llama on a Mac using Ollama, a powerful tool for setting up and running large language models locally.

Setup

For this demonstration, we are using a MacBook Pro running macOS Sonoma 14.4.1 with 64GB of memory. While we focus on macOS, similar steps can be followed for other operating systems like Linux or Windows.

Installing Ollama

Ollama is essential for running large language models like Llama locally. Here’s how to get started:

  1. Visit the Ollama Website: Go to the Ollama website and select your platform.
  2. Download Ollama for macOS: Click on “Download for macOS” to get the installation file.
  3. Install Ollama: Follow the on-screen instructions to complete the installation.

Downloading Meta Llama Models

Ollama provides Meta Llama models in a 4-bit quantized format, making them more efficient to run on local machines. Here’s how to download them:

  1. Open Terminal: Launch the terminal on your Mac.
  2. Download the 8B Model: Run the following command to download the 4-bit quantized Meta Llama 3 8B chat model:
    sh
    1ollama pull llama3
    This model is about 4.7 GB in size.
  3. Download the 70B Model (Optional): For the larger 70B model, use:
    sh
    1ollama pull llama3:70b
    This model is approximately 39 GB in size.

Running the Model

Using ollama run

To run the Llama 3 model, follow these steps:

  1. Run the Model: In your terminal, type:

    sh
    1ollama run llama3
  2. Ask Questions: You can now interact with the model by typing your questions. For example:

    sh
    1Who wrote the book Godfather?

    The model will respond with detailed information.

  3. Specific Responses: To get concise answers, specify your request:

    sh
    1Who wrote the book Godfather? Answer with only the name.

Using curl

You can also interact with the Llama model using the curl command:

  1. Run with curl: In your terminal, enter:
    sh
    1curl http://localhost:11434/api/chat -d '{
    2  "model": "llama3",
    3  "messages": [
    4    {
    5      "role": "user",
    6      "content": "Who wrote the book Godfather?"
    7    }
    8  ],
    9  "stream": false
    10}'
  2. View Response: The model will generate and return the response.

Using a Python Script

To run the Llama model using a Python script, follow these steps:

  1. Install Python: Visit the Python website to download and install Python for macOS.
  2. Create a Script: Open your code editor and create a new Python file. Add the following code:
    python
    1import requests
    2import json
    3
    4url = "http://localhost:11434/api/chat"
    5
    6def llama3(prompt):
    7    data = {
    8        "model": "llama3",
    9        "messages": [
    10            {
    11                "role": "user",
    12                "content": prompt
    13            }
    14        ],
    15        "stream": False,
    16    }
    17
    18    headers = {
    19        "Content-Type": "application/json"
    20    }
    21
    22    response = requests.post(url, headers=headers, json=data)
    23    return response.json()["message"]["content"]
    24
    25response = llama3("Who wrote the book Godfather?")
    26print(response)
  3. Run the Script: In your terminal, navigate to the script’s directory and run:
    sh
    1python <name_of_script>.py

Exploring More Examples and Resources

To further explore Llama models and integrate them into your applications, check out the following resources:

  • Llama-Recipes GitHub Repo: Find detailed examples and walkthroughs for running Llama models on various platforms, including installation instructions, dependencies, and use cases.
  • Build with Meta Llama Series: Discover more tutorials and videos that showcase the practical applications of Llama models.

I hope this guide helps you get started with Meta Llama on your Mac.