How to Run Ollama on an M1 MacBook Air Using Multipass
How to Run Ollama on an M1 MacBook Air Using Multipass
This guide explains how to install and run Ollama on your MacBook Air M1 using Multipass. You'll set up an Ubuntu VM with custom resources and then install Ollama inside it. Follow these steps to get started.
Step 1: Install Multipass on Your M1 MacBook Air
Download Multipass:
- Visit the Multipass website.
- Download the macOS installer compatible with the ARM architecture.
Install Multipass:
- Open the downloaded installer package.
- Follow the on-screen instructions to complete the installation.
- Once installed, Multipass is ready to manage Ubuntu VMs.
Step 2: Launch an Ubuntu Instance with Custom Resources
Since installing Ollama may require additional space and memory, launch a new instance with custom allocations.
Open Terminal:
Use the built-in Terminal on your Mac.Delete Existing Instances (if necessary):
If you have an instance with the same name, delete it by running:
multipass delete myubuntu
Purge deleted instances:
multipass purge
Launch a New Instance:
Use the command below to create an instance with 6GB of RAM and 50GB of disk space:
multipass launch --name myubuntu --memory 6G --disk 50G
Multipass will download the Ubuntu image (if not cached) and launch your VM.
Verify the Instance:
Check the assigned resources with:
multipass info myubuntu
Step 3: Connect to Your Ubuntu VM
- Access the Ubuntu Shell:
Run the following command to connect:
multipass shell myubuntu
You are now inside your Ubuntu environment.
Step 4: Install Ollama in the Ubuntu VM
Now that the VM is running, install Ollama using its installation script.
Update Package Repository (Optional but Recommended):
Inside the VM, update packages:
sudo apt update
Download and Install Ollama:
Run the installation command:
curl -fsSL https://ollama.com/install.sh | sudo bash
The script will download the Linux arm64 bundle for Ollama and install it into
/usr/local
.Note: If you encounter errors like “No space left on device,” confirm that you launched the VM with sufficient disk space (50G in our example).
Troubleshooting Disk Errors:
If insufficient disk space errors occur during installation, make sure the
--disk
option was correctly set when launching the instance.Check available disk space with:
df -h
Step 5: Running and Using Ollama
Verify Ollama Installation:
Once installed, check if Ollama is available by:
ollama --version
If the command is not found, double-check the installation path and ensure
/usr/local/bin
is in your PATH variable.
Launch or Configure Ollama:
- Follow Ollama's documentation for further configuration and usage.
- Typical usage instructions can be found on Ollama's website.
Additional Tips
Manage Your VM:
To stop the instance when not in use:
multipass stop myubuntu
To start it again:
multipass start myubuntu
Deleting and Recreating:
If you need a fresh start, delete the instance with:
multipass delete myubuntu
And purge it with:
multipass purge
Resources Adjustment:
- For future adjustments, launch a new instance with your required
--memory
and--disk
parameters.
- For future adjustments, launch a new instance with your required
Conclusion
By following this guide, you now have Multipass installed on your M1 MacBook Air, an Ubuntu VM configured with ample resources, and Ollama installed within that VM. This setup provides a lightweight, isolated environment for running and testing Ollama on your MacBook Air. If you have any questions or encounter issues, feel free to leave a comment or seek help.
Happy Multipassing and enjoy using Ollama!
Comments
Post a Comment