Using UTM on M-series Mac laptops
Visit https://mac.getutm.app/, then click “Download”. (Downloading from the UTM website is more reliable than following the “Mac App Store” link.)
Once downloaded, locate and select the .dmg file you have downloaded. A dialog box should appear. Click and drag the icon to your Applications folder.
You’ll need to download one or more virtual machine images, and then create virtual machines from them that you’ll use as a development environment. (You can download more than one, and you can delete any downloaded image if you like and try again.)
There are many options for downloading a virtual machine image – we outline three possibilities.
The “gallery” of pre-built UTM virtual machines doesn’t include any for Ubuntu 20.04, but it does include one for Ubuntu 22.04, which is very similar. You can visit this link to download the Ubuntu 22.04 image. Clicking the “Open in UTM” link should download the virtual machine image and open it using UTM.
This image uses an ARM64 processor, so it is not the same as the CITS3007 standard development environment (SDE) – see here for some of the differences. For most purposes, the virtual machine you’ve downloaded should behave quite similarly to the CITS3007 SDE, but:
char
type on an x86-64 platform is signed, but on
ARM64 platforms it is unsigned. You may want to make use of
GCC’s -fsigned-char
option to mimic the x86-64 behaviour
(see here). It’s also recommended that you
test your code using a x86-64 virtual machine before submitting.The “gallery” of pre-built UTM virtual machines includes an image for a very old (2013) version of Ubuntu 14.04, which you should be able to use in order to test code on an x86-64 platform. However, x86-64 images run much more slowly than ARM64 images do – your Mac has to emulate a very different sort of CPU.
You can visit this link to download the Ubuntu 14.04 image. Clicking the “Open in UTM” link should download the virtual machine image and open it using UTM.
Another possibility, although it has not been very thoroughly tested, is to use UTM with a CITS3007 x86-64 Qcow image file.
A Qcow image file – a format related to the one UTM uses – is available for the x86-64 CITS3007 standard development environment (SDE). However, UTM doesn’t provide very clear documentation on how such files can be used. Nevertheless, if you wish to try it, and are familiar with the Linux command line, some general instructions are:
.box
file from here
to your machine (the saved file should be called
vagrant.box
).box.img
from the
vagrant.box
file using tar
(vagrant.box
is a standard gzipped tar file).box.img
to cits3007.qcow2
.A former CITS3007 student has also provided some tips on working with UTM here (PDF).
In the following section of this lab sheet, we discuss some ways that an ARM64 platform can differ from the x86-64 platform.
The standard CITS3007 development environment runs on the x86-64 architecture, and any code you submit for the CITS3007 project will be compiled and tested using GCC on the x86-64 architecture.
M-series Mac laptops, however, use the ARM64 architecture, which differs from x86-64 in several ways (note that the following list is not comprehensive!):
char
type can be either signed or unsigned – on the
x86-64 platform, a char
is usually signed, but when
targeting the ARM64 architecture, C compilers (including GCC) usually
default to it being unsigned (for performance
reasons that are now largely historical).char
type signed
or unsigned by using the -funsigned-char
and -fsigned-char
options.You can find comments on some of these differences in the “Miscellaneous C porting issues” section of the developer documentation for the ARMv7-A series of processors.
Projects will be tested on the x86-64 platform, using GCC as a compiler, and the CITS3007 standard development environment.
It’s up to you to make sure that you thoroughly test your code and ensure it runs correctly on the x86-64 platform. Some suggestions as to how you might do so include: