I eventually managed to spin up all the processes (libvirtd, virtlogd, virtlockd) individually and under root, which also helped exposing the read-only socket. I gathered from reading through the libvirt source code that the read-only socket is only activated under privileged mode which has led me down that path.

With all this running, I went back to my automation efforts with Vagrant libvirt and realized that it wants to make a call that doesn't seem supported on macOS (yet):

Call to virDomainCreateWithFlags failed: Unable to create TAP devices on this platform: Function not implemented

^ which I suppose confirms the mentioned worries of Michal

So I can say that while running libvirt on macOS isn't super smooth it's possible. :)
The sharp edges around permissions and launchd plist files is something that can be smoothed out eventually and that is probably something to resolve on the distribution side (e.g. Homebrew) anyway, not necessarily on libvirt's.

Radek Simko


On Fri, Apr 2, 2021 at 5:47 PM Radek Simko <radek.simko@gmail.com> wrote:
Recompiling with these few changes helped and the networking drivers _seems_ to be working on macOS.
At least I got past the error I was getting initially.

I'm just now dealing with a slightly different set of problems related to libvirt sockets on macOS.
The Homebrew formula ships a launchd plist which doesn't seem to do socket activation, unlike systemd.
I worked around that by setting the socket dir path manually in the config:

unix_sock_dir = "/usr/local/var/run/libvirt"

which did make libvirtd create "libvirt-sock" in that directory as expected, but per docs there should also be a secondary read-only socket "libvirt-sock-ro" https://libvirt.org/daemons.html#monolithic-sockets and it's not there for some reason. Is there any additional configuration needed to activate that secondary socket?

Feel free to tell me if this is getting too off-topic btw. - The big picture is that I'm trying to get libvirt working on darwin and automate RPi virtualization via Vagrant (vagrant-libvirt) and taking it step by step.

Radek Simko


On Thu, Apr 1, 2021 at 2:54 PM Andrea Bolognani <abologna@redhat.com> wrote:
On Wed, 2021-03-31 at 21:39 +0100, Radek Simko wrote:
> I was attempting to virtualize Raspberry Pi on qemu via libvirt,
> where my host machine is macOS (both qemu and libvirt installed via
> Homebrew) and I while trying to set up the network I stumbled upon
> this:
>
> $ virsh -c qemu:///system?socket=/usr/local/var/run/libvirt/libvirt-sock net-list --all

Aside: if you have libvirt >= 6.9.0, which at this point is very
likely, you shouldn't need to include the 'socket' parameter in the
connection URI; in fact, for local connections, it should have worked
without the parameter even before that.

--
Andrea Bolognani / Red Hat / Virtualization