How to Share Files Between macOS and Ubuntu VM in UTM (EASY GUIDE)

AXXSHENAXXSHEN
3 min read

Works on Apple Silicon (M1/M2/M3), using UTM + Ubuntu 25.04 ARM64


✨ What I Wanted

I use macOS, and I made a virtual machine (VM) with Ubuntu using UTM.

I wanted to:

  • Share a folder called UTM-Share

  • Use it in both macOS and the Ubuntu VM

  • Open, copy, and edit files from either side

But it was not working at first. I got many errors 😩
Now it works ✅ — and this guide will help you fix it too!


❌ What Didn't Work

❌ Virtio 9p Share

This is the default share type in UTM (virtfs, or 9p).

I tried:

sudo modprobe 9p
sudo modprobe 9pnet
sudo modprobe 9pnet_virtio

But got this error:

modprobe: Module 9pnet_virtio not found

So 9p share doesn’t work well in Ubuntu ARM64.


❌ SMB Mount (First Try)

I enabled file sharing on macOS, but still saw:

mount error(13): Permission denied

✅ The Working Solution: Use SMB with Correct Settings


1️⃣ Setup File Sharing on macOS

  1. Open System Settings → General → Sharing

  2. Turn on ✅ File Sharing

  3. Click “i” or “Details” to:

    • Add folder: UTM-Share

    • Set permission: "Read & Write"

  4. Click “Options…”:

    • ✅ Enable “Share files using SMB

    • ✅ Enable your macOS user account and enter password


2️⃣ Install CIFS Utils in Ubuntu

Open Terminal in Ubuntu VM:

sudo apt update
sudo apt install cifs-utils

3️⃣ Create a Mount Folder

This is where Ubuntu will show the macOS files:

sudo mkdir -p /mnt/macshare

4️⃣ Save Your Mac Login Info (Optional but Safe)

Make a file:

nano ~/.smbcred

Write this inside:

username=YOUR_MAC_USERNAME
password=YOUR_MAC_PASSWORD

✅ Example:
username=aoshen
password=011218

Then secure the file:

chmod 600 ~/.smbcred

5️⃣ Mount the Shared Folder

Now run:

sudo mount -t cifs //YOUR-MAC-IP/UTM-Share /mnt/macshare \
  -o credentials=/home/YOUR_UBUNTU_USERNAME/.smbcred,uid=$(id -u),gid=$(id -g),rw,vers=3.0

Replace YOUR-MAC-IP with your real IP address (you can find it under Wi-Fi settings)

✅ Example:

sudo mount -t cifs //172.20.10.3/UTM-Share /mnt/macshare \
  -o credentials=/home/aoshendev/.smbcred,uid=$(id -u),gid=$(id -g),rw,vers=3.0

6️⃣ Check If It Works

Run:

ls /mnt/macshare

You should see your Mac files inside Ubuntu. 🎉


🧯 Common Errors & Fixes

ProblemSolution
Permission deniedCheck username/password, or try using .smbcred file
Nothing in /mnt/macshareWrong mount path? Make sure IP and folder name are correct
Module 9pnet_virtio not foundDon’t use VirtIO (9p). Use SMB/CIFS instead
Folder not visible in UbuntuTry ls /mnt/macshare again, or reboot

🧪 Tested Setup

ComponentVersion
macOSSonoma 14.x
UTMQEMU 9.1 (ARM)
Ubuntu25.04 ARM64
Share FolderUTM-Share
ProtocolSMB (CIFS) v3.0

🧠 Final Tips

  • You only need to set up sharing once in macOS.

  • If your network IP changes, update the mount command.

  • You can add this mount to /etc/fstab for auto-mount (advanced).


🙌 Now You Can Share Files Between macOS and Ubuntu Easily!

Let me know if you want a guide for:

  • Auto-mounting on startup

  • Making this work with Parallels, VMware, or VirtualBox

Thanks for reading — Happy coding!

0
Subscribe to my newsletter

Read articles from AXXSHEN directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

AXXSHEN
AXXSHEN