Installing QEMU on Mac OS X El Capitan

QEMU is an open source computer emulator. Here I describe how I installed QEMU on Mac OS X El Capitan.

My goal was to learn more about building QEMU, and to boot Linux on QEMU, and to check if there were differences in the installation compared to when doing it on Mac OS X Yosemite.

I downloaded and unpacked QEMU 2.5.0 (this was the latest stable release at the date I did the download), by doing

wget http://wiki.qemu-project.org/download/qemu-2.5.0.tar.bz2
tar xvjf qemu-2.5.0.tar.bz2
cd qemu-2.5.0

Then, based on my earlier experiences, I used the configure command

./configure --enable-cocoa --target-list=i386-softmmu,arm-softmmu,x86_64-softmmu --disable-vnc

and it succeeded! Here I took advantage of my previous installation of rudix, and the use of rudix for installing glib, which I did using the command

sudo rudix install glib

This installation of glib prevented an error printout

ERROR: glib-2.22 gthread-2.0 is required to compile QEMU

The next step is building, which I did by simply typing make, but that did not succeed.

There were warnings, but also errors. I searched using google, using the error printout as search terms. This led me to this page with advice, which told me to add make targets, resulting in lines like

region_test_OBJECTS = region-test.$(OBJEXT) utils.$(OBJEXT)

and

scaling_helpers_test_OBJECTS = scaling-helpers-test.$(OBJEXT) utils.$(OBJEXT)

in the file

./pixman/test/Makefile

where the targets utils.$(OBJEXT) were added by me.

The errors went away, resulting in a successful build. Again, I was helped by my earlier experiences, where I learned how to prevent link errors by installing gettext using rudix, as

sudo rudix install gettext

I could then do make install to install my new QEMU.

Now I wanted to boot Linux! I looked at the QEMU Testing page, and decided to download and unpack a Linux image for ARM by doing

wget http://wiki.qemu.org/download/arm-test-0.2.tar.gz
tar zxvf arm-test-0.2.tar.gz

A Linux boot could then be done, by starting QEMU with the downloaded Linux image as argument, as

cd arm-test
qemu-system-arm -machine integratorcp -kernel zImage.integrator -initrd arm_root.img -nographic -append "console=ttyAMA0"

When done, QEMU can be shut down by doing Ctrl-A x.