After googling quite extensively I was unable to find a definitive guide to compile QEMU on OS X Yosemite so I pieced together the steps myself and have documented them below. It should be noted that MacPorts does have a port for QEMU 2.3 but I wanted to compile the newest version from GitHub myself.
It is assumed that Xcode and the CLI tools are already installed.
The first and most important step is to install MacPorts
After this is complete it is a simple matter of installing the required ports from the command line.
- sudo port install pkgconfig
- sudo port install glib2
- sudo port install libpixman
- sudo port self update
- sudo port upgrade outdated
After the ports have been installed the QEMU source should be downloaded from github from the command line.
- git clone git://git.qemu.org/qemu.git;
After downloading the source the most important piece of the puzzle seems to be the following
- cd qemu
- git submodule update –init dtc
Once this submodule has been downloaded you can configure and make QEMU.
- ./configure –enable-cocoa –target-list=i386-softmmu,arm-softmmu,x86_64-softmmu,aarch64-softmmu –disable-vnc
- make
This particular configuration demonstrates compiling several of the target architectures available in QEMU. Adding or removing architectures from the –target-list will be required to meet your particular needs.
If QEMU builds successfully you should now have directories for each architecture listed in the –target-list.
A simple way to test that everything is working as expected is to run QEMU for x86_64. Before you do this however it is worth downloading the Tiny Core Linux iso for testing in QEMU.
- ./x86_64-softmmu/qemu-system-x86_64 -cdrom Core-current.iso -boot d -net nic -net user,hostfwd=tcp:127.0.0.1:8008-:80
Tiny Core Linux should boot and drop you to a command prompt after pressing “enter”.
The following links were invaluable in helping to determine exactly how to build and test QEMU 2.4 on the Mac.
https://jon.sprig.gs/blog/post/53
https://github.com/psema4/pine/wiki/Installing-QEMU-on-OS-X
http://blog.definedcode.com/osx-qemu-kvm
https://theintobooks.wordpress.com/2012/10/30/installing-qemu/
http://blogs.coreboot.org/blog/2015/06/03/gsoc-coreboot-for-arm64-qemu-week-1/
http://www.bennee.com/~alex/blog/2014/05/09/running-linux-in-qemus-aarch64-system-emulation-mode/