Skip to content

Add support for Apple Virtualization VMs with VirtioFS and mDNS SSH#44

Open
DimmKirr wants to merge 1 commit intonaveenrajm7:mainfrom
DimmKirr:feature/macos
Open

Add support for Apple Virtualization VMs with VirtioFS and mDNS SSH#44
DimmKirr wants to merge 1 commit intonaveenrajm7:mainfrom
DimmKirr:feature/macos

Conversation

@DimmKirr
Copy link
Copy Markdown

@DimmKirr DimmKirr commented Jan 24, 2026

Description

Due to missing api integrations there is no way to run MacOS as a guest (at least I was not able to do it).
I've made some fixes and added a workaround for adding shared volumes manually.
I've also added an acceptance test.

This test needs a local macOS26 box with the following:
(I wish I could attach a packer.hcl file, but due to the same limitations it doesn't seem to be possible yet)

  1. vagrant user
  2. SSH/Sharing enabled
  3. Homebrew (used for a conceptual brew version test)
  4. Have a hostname vagrant-macos (since mDNS seems to be the only way to connect to it nicely)

Changes

  • feat(vagrantfile_examples/macOS): add example Vagrantfile for Apple Virtualization using VirtioFS and mDNS SSH
  • feat(test/acceptance/macos): add acceptance Vagrantfile and shell script to test macOS Apple Virtualization VMs with VirtioFS
  • feat(lib/vagrant_utm/config): add skip_directory_share_mode config to disable QEMU directory share mode for Apple Virtualization
  • feat(lib/vagrant_utm/synced_folder): skip folder auto-setup for Apple VMs; prompt manual VirtioFS config via UTM GUI
  • feat(lib/vagrant_utm/action): add PromptVirtioFS action to warn users to manually configure shared folders in UTM GUI for Apple VMs
  • fix(lib/vagrant_utm/driver/version_4_5): handle unsupported ip-address command error gracefully for Apple Virtualization VMs
  • fix(lib/vagrant_utm/driver/version_4_6): add missing -l JavaScript argument to osascript calls for shared folder commands
  • chore(Gemfile): add vagrant-spec gem for acceptance testing
  • chore(Rakefile): add test tasks with unit and acceptance specs including macOS tests
  • test(test/acceptance/provider/macos_spec): add acceptance tests verifying VM boot, SSH, Homebrew, and synced folder functionality on macOS Apple Virtualization VMs
  • docs(vagrantfile_examples/macOS/README.md): add comprehensive instructions for creating and using macOS Vagrant boxes with UTM Apple Virtualization provider, including manual VirtioFS folder setup and troubleshooting tips

Testing

Run Test & Get the Shared Dir Path

$ vagrant plugin uninstall vagrant_utm; gem build vagrant_utm.gemspec && vagrant plugin install ./vagrant_utm-*.gem &&  rake test:macos

Uninstalling the 'vagrant_utm' plugin...
Successfully uninstalled vagrant_utm-0.1.5
WARNING:  lib/vagrant_utm/action/prompt_virtiofs.rb is not world-readable
WARNING:  vagrantfile_examples/macOS/README.md is not world-readable
WARNING:  See https://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: vagrant_utm
  Version: 0.1.5
  File: vagrant_utm-0.1.5.gem
Installing the './vagrant_utm-0.1.5.gem' plugin. This can take a few minutes...
Installed the plugin 'vagrant_utm (0.1.5)'!
test/acceptance/macos/run.sh
==> Starting VM...
Bringing machine 'default' up with 'utm' provider...
==> default: Importing base box 'macOS26'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: macos_default_1769251116938_28779
==> default: Forwarding ports...
==> default: Running 'pre-boot' VM customizations...
==> default:
==> default: ======================================================================
==> default:   MANUAL STEP REQUIRED: VirtioFS Shared Folders
==> default: ======================================================================
==> default:
==> default: Apple Virtualization VMs require manual shared folder setup.
==> default: macOS security restrictions prevent automated configuration.
==> default:
==> default: Please complete these steps in UTM:
==> default:
==> default:   1. Open UTM application
==> default:   2. Right-click 'default' -> Edit
==> default:   3. Go to 'Sharing' tab
==> default:   4. Remove existing entries (if any), then re-add these paths:
==> default:
==> default:      -> /Users/dmitry/dev/dimmkirr/vagrant_utm/test/acceptance/macos
==> default:         (mounts at: /Volumes/My Shared Files/macos/)
==> default:
==> default:   5. Save the VM settings
==> default:
==> default: ======================================================================
==> default:
    default: Press ENTER when done to continue booting the VM...

At this point vagrant pauses and waits for our manual intervention

Manually Configure Shared Dir

image image image

Press Enter

    default: Press ENTER when done to continue booting the VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: vagrant-macos.local:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: VirtioFS shared folders auto-mount at /Volumes/My Shared Files/
==> default: Running provisioner: shell...
    default: Running: inline script
==> Verifying SSH...
Darwin vagrant-macos.local 25.1.0 Darwin Kernel Version 25.1.0: Mon Oct 20 19:32:18 PDT 2025; root:xnu-12377.41.6~2/RELEASE_ARM64_VMAPPLE arm64
==> Verifying Homebrew...
Homebrew 5.0.9
==> Verifying symlinked path...
==> Verifying bidirectional sync...
==> ALL TESTS PASSED
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...

- feat(vagrantfile_examples/macOS): add example Vagrantfile for Apple Virtualization using VirtioFS and mDNS SSH
- feat(test/acceptance/macos): add acceptance Vagrantfile and shell script to test macOS Apple Virtualization VMs with VirtioFS
- feat(lib/vagrant_utm/config): add skip_directory_share_mode config to disable QEMU directory share mode for Apple Virtualization
- feat(lib/vagrant_utm/synced_folder): skip folder auto-setup for Apple VMs; prompt manual VirtioFS config via UTM GUI
- feat(lib/vagrant_utm/action): add PromptVirtioFS action to warn users to manually configure shared folders in UTM GUI for Apple VMs
- fix(lib/vagrant_utm/driver/version_4_5): handle unsupported ip-address command error gracefully for Apple Virtualization VMs
- fix(lib/vagrant_utm/driver/version_4_6): add missing -l JavaScript argument to osascript calls for shared folder commands
- chore(Gemfile): add vagrant-spec gem for acceptance testing
- chore(Rakefile): add test tasks with unit and acceptance specs including macOS tests
- test(test/acceptance/provider/macos_spec): add acceptance tests verifying VM boot, SSH, Homebrew, and synced folder functionality on macOS Apple Virtualization VMs
- docs(vagrantfile_examples/macOS/README.md): add comprehensive instructions for creating and using macOS Vagrant boxes with UTM Apple Virtualization provider, including manual VirtioFS folder setup and troubleshooting tips
@DimmKirr
Copy link
Copy Markdown
Author

Hi @naveenrajm7 , LMK if there are any changes I could make to make this easier (or if it doesn't look reasonable, that's fine too!)

Thanks!

@naveenrajm7
Copy link
Copy Markdown
Owner

Hi @DimmKirr

Thanks a lot for your contribution.
There are lot requests to support Apple backend VMs.
In order to provide long term support for Apple VMs, I am thinking to do it via different driver for Apple VMs (config.vm_backend). So we can tune via driver rather multiple if else.

@naveenrajm7
Copy link
Copy Markdown
Owner

utmapp/UTM#7643

When IP address for Apple backend arrives it makes our life easier to support Apple backed VMs, so no dns hack needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants