百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
H

homebrew-qemu-virgl

> 编程语言
开源

一个用于 qemu 的自制设备,支持 3D 加速客户机

446 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

一个用于 qemu 的自制设备,支持 3D 加速客户机

3D accelerated qemu on MacOS

What is it for

If you own a Mac (x86 or ARM) and want to have a full Linux desktop for development or testing, you'll find that having a responsive desktop is a nice thing. The graphical acceleration is possible thanks to the work of Akihiko Odaki. I've only packaged it into an easily-installable brew repository while the changes are not yet merged into upstream.

Features:

  • Support for both ARM and X86 acceleration with Hypervisor.framework (works without root or kernel extensions)
  • Support for OpenGL acceleration in the guest (both X11 and Wayland)
  • Works on large screens (5k+)
  • Dynamically changing guest resolution on window resize
  • Properly handle sound output when plugging/unplugging headphones

Installation

brew install knazarov/qemu-virgl/qemu-virgl

Or brew tap knazarov/qemu-virgl and then brew install qemu-virgl.

Usage

Qemu has many command line options and emulated devices, so the sections are specific to your CPU (Intel/M1).

For the best experience, maximize the qemu window when it starts. To release the mouse, press Ctrl-Alt-g.

Usage - M1 Macs

Latest release needs virtio-gpu-gl-pci command line option instead of virtio-gpu-pci, otherwise gpu acceleration won't work

First, create a disk image you'll run your Linux installation from (tune image size as needed):

bash
qemu-img create hdd.raw 64G

Download an ARM based Fedora 35 image:

bash
curl -LO https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/releases/35/Workstation/aarch64/iso/Fedora-Workstation-Live-aarch64-35-1.2.iso

Copy the firmware:

bash
cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .
cp $(dirname $(which qemu-img))/../share/qemu/edk2-arm-vars.fd .

Install the system from the CD image:

…

Run the system without the CD image to boot into the primary partition:

…

Usage - Intel Macs

First, create a disk image you'll run your Linux installation from (tune image size as needed):

bash
qemu-img create hdd.raw 64G

Download an x86 based Fedora 35 image:

bash
curl -LO https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/fedora/linux/releases/35/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-35-1.2.iso

Install the system from the CD image:

bash
qemu-system-x86_64 \
         -machine accel=hvf \
         -cpu Haswell-v4 -smp 2 -m 4G \
         -device intel-hda -device hda-output \
         -device qemu-xhci \
         -device virtio-vga-gl \
         -device usb-kbd \
         -device virtio-net-pci,netdev=net \
         -device virtio-mouse-pci \
         -display cocoa,gl=es \
         -netdev user,id=net,ipv6=off \
         -drive "if=virtio,format=raw,file=hdd.raw,discard=on" \
         -cdrom Fedora-Workstation-Live-x86_64-35-1.2.iso \
         -boot d

Run the system without the CD image to boot into the primary partition:

bash
qemu-system-x86_64 \
         -machine accel=hvf \
         -cpu Haswell-v4 -smp 2 -m 4G \
         -device intel-hda -device hda-output \
         -device qemu-xhci \
         -device virtio-vga-gl \
         -device usb-kbd \
         -device virtio-net-pci,netdev=net \
         -device virtio-mouse-pci \
         -display cocoa,gl=es \
         -netdev user,id=net,ipv6=off \
         -drive "if=virtio,format=raw,file=hdd.raw,discard=on"

Usage - Advanced

This section has additional configuration you may want to do to improve your workflow

Clipboard sharing

There's now support for sharing clipboard in both directions: from vm->host and host->vm. To enable clibpoard sharing, add this to your command line:

bash
         -chardev qemu-vdagent,id=spice,name=vdagent,clipboard=on \
         -device virtio-serial-pci \
         -device virtserialport,chardev=spice,name=com.redhat.spice.0

Mouse integration

By default, you have mouse pointer capture and have to release mouse pointer from the VM using keyboard shortcut. In order to have seamless mouse configuration, add the following to your command line instead of -device virtio-mouse-pci:

	-device usb-tablet \

MacOS native networking for VMs (vmnet)

akihikodaki's patch set includes support for vmnet which offers more flexibility than -netdev user, and allows higher network throughput. (see https://github.com/akihikodaki/qemu/commit/72a35bb6e0a16bb7d346ba822a6d47293915fc95).

For instance, to enable bridge mode, replace:

bash
    -device virtio-net-pci,netdev=net \
    -netdev user,id=net,ipv6=off \

with

bash
    -netdev vmnet-macos,id=n1,mode=bridged,ifname=en0 \
    -device virtio-net,netdev=n1 \

vmnet also offers "host" and "shared" networking model:

   -netdev vmnet-macos,id=str,mode=host|shared[,dhcp_start_address=addr,dhcp_end_address=addr,dhcp_subnet_mask=mask]

caveats:

  1. vmnet requires running qemu as root, for now.
  2. current vmnet API (Apple) doesn't support setting MAC address, so it will be randomized every time the VM is started.

To work around 2), for now it's possible to set the MAC address within the VM.

As root, create a file /etc/udev/rules.d/75-mac-vmnet.rules with the following content:

ACTION=="add", SUBSYSTEM=="net", KERNEL=="enp0s3", RUN+="/usr/bin/ip link set dev %k address 00:11:22:33:44:55"

replace enp0s3 with the name of your interface and 00:11:22:33:44:55 with the desired MAC address.

Reboot or issue a ip link set dev enp0s3 address 00:11:22:33:44:55 to change your MAC address.

Issues· 41 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言