Umgebung für virtuelle Maschinen
Abhängigkeiten vorbereiten
brew update
brew install pkg-config glib pixman libpng jpeg spice-protocol spice-gtk gnutls ninja meson gtk+3 libusb sdl2 gnutls libslirp llvm
Compile QEMU with SPICE
Download the latest QEMU source (e.g., 9.0.2 or newer; check https://www.qemu.org/download/ for the current version):
curl -O https://download.qemu.org/qemu-10.0.3.tar.xz
tar -xJf qemu-10.0.3.tar.xz
cd qemu-10.0.3
brew update
brew install pkg-config glib pixman libpng jpeg spice-protocol spice-gtk gnutls ninja meson gtk+3 libusb sdl2 gnutls libslirp llvm
/usr/local/bin/python3 -m venv ~/qemu-venv
source ~/qemu-venv/bin/activate
pip install distlib
pip show distlib
source ~/qemu-venv/bin/activate
which python3
/usr/local/opt/llvm/bin/clang --version
export PATH="/usr/local/opt/llvm/bin:$PATH"
export CC="/usr/local/opt/llvm/bin/clang"
export CXX="/usr/local/opt/llvm/bin/clang++"
which clang
Should show /usr/local/opt/llvm/bin/clang
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc
echo 'export CC="/usr/local/opt/llvm/bin/clang"' >> ~/.zshrc
echo 'export CXX="/usr/local/opt/llvm/bin/clang++"' >> ~/.zshrc
source ~/.zshrc
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
export LDFLAGS="-L/usr/local/opt/openssl@3/lib -L/usr/local/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include -I/usr/local/include"
source ~/qemu-venv/bin/activate
- Configure with SPICE and other options (this enables SPICE via the installed spice-server, targets x86_64 for your host/guest, and includes macOS-friendly flags):
./configure --enable-spice --enable-usb-redir --enable-cocoa --enable-sdl --enable-gnutls --enable-libusb --enable-slirp --target-list=x86_64-softmmu --prefix=/usr/local --cc=/usr/local/opt/llvm/bin/clang --cxx=/usr/local/opt/llvm/bin/clang++ --extra-cxxflags="-std=c++17"
- If configure complains about missing SPICE, verify pkg-config –exists spice-server returns nothing (success) or check paths.
- Add –disable-capstone if you get errors about it (optional dependency).
Check output for:
spice support: yes
to be sure:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig:$PKG_CONFIG_PATH"
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
Build and install:
make -j$(sysctl -n hw.ncpu)
sudo make install
Verify SPICE support:
qemu-system-x86_64 --version # Should show your compiled version
qemu-system-x86_64 -display help # Look for "spice" or "spice-app" in the list
qemu-system-x86_64 -display spice-app # If no error, SPICE is enabled
VM starten (muss vorher da sein oder installiert werden 😉
qemu-system-x86_64 \
-m 4G \ # Allocate 4GB RAM (half your host's for safety)
-smp 4 \ # 4 CPU cores
-cpu host \ # Pass through host CPU for better perf
-accel hvf \ # macOS hardware acceleration
-drive file=opensuse.qcow2,format=qcow2 \
-cdrom /path/to/OpenSUSE-Leap-15.6-DVD-x86_64.iso \
-vga qxl \
-spice port=5900,addr=127.0.0.1,disable-ticketing=on \
-device virtio-serial-pci \
-device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \
-chardev spicevmc,id=spicechannel0,name=vdagent \
-usb -device usb-tablet # Better mouse input
This starts SPICE on localhost port 5900. Connect to the VM display in another Terminal tab:
spicy -h 127.0.0.1 -p 5900
zypper install spice-vdagent qemu-guest-agent
systemctl enable --now spice-vdagentd
systemctl enable --now qemu-guest-agent
Troubleshooting
- SPICE slow/refresh issues: SPICE on macOS can be laggy; try -vga virtio instead of qxl for better perf, or use -display cocoa as fallback (no SPICE).
- Errors during compile: Paste the exact error for help. Ensure Xcode Command Line Tools are installed (xcode-select –install).
- No sound/graphics: Add -soundhw hda for audio. For full-screen/resolution auto-adjust, ensure spice-vdagent is running in guest.
- Host resources: With 16GB RAM, limit VM to 8GB max to avoid host slowdowns.
UNINSTALL
cd ~/.src/qemu-10.0.3
sudo make uninstall
sudo rm -rf /usr/local/bin/qemu*
sudo rm -rf /usr/local/libexec/qemu*
sudo rm -rf /usr/local/share/qemu*
sudo rm -rf /usr/local/lib/qemu*
sudo rm -rf /usr/local/include/qemu*