Skip to main content

How to create a virtual machine on macbook m cpu using qemu

Qemu is one of the virtualizations technology, with qemu we can make a virtualization OS. It can be installed on the MacOS as well.


Install Qemu

brew install qemu


Check installed version

qemu-system-x86_64 --version


Create a virtual disk for a VM.

e.g:

mkdir -p ~/MY/VM/DEBIAN

qemu-img create -f qcow2 ~/MY/VM/DEBIAN/debian-vm1.qcow2 40G

Output:

Formatting 'debian-vm1.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=42949672960 lazy_refcounts=off refcount_bits=16


Boot from ISO for installation.

Download the installer ISO file and place it to the same directory. Once ISO file is downloaded we can start to installing the VM:

qemu-system-x86_64 -m 2G -vga virtio -display default,show-cursor=on -usb -device usb-tablet -smp 2 -cdrom debian-12.2.0-amd64-netinst.iso -drive file=debian-vm1.qcow2,if=virtio


Run VM in the bridge network

qemu-system-x86_64 debian-vm1.qcow2 \ -smp cpus=2 -m 2G \ -nic vmnet-bridged,ifname=en0


Command options

qemu-system-x86_64 --help


That's it, Thank You.








Comments