In this post, we will cover how to install SingularityCE on a macOS machine running on Apple Silicon (M1/M2 and their variants). We will do this using the free and open-source UTM
, which will allow us to run an ARM64 Linux virtual machine on macOS using native virtualization.
Downloading & installing UTM
In your browser, go to mac.getutm.app, and click on the Download button.
Mount the downloaded UTM.dmg disk-image and drag the UTM app to the Applications folder.
Next, launch the UTM app from your Mac’s local Applications folder. (Depending on your Mac’s security settings, you may get a confirmation dialog when you launch UTM for the first time. If such a dialog appears, choose Open.)
This should bring you to the main UTM application window, which looks like this:
Download an ISO image
Before launching the VM, download the operating system ISO image. In this blog, we will be using Rocky Linux, for demonstration purposes. Go to the following link and download the file:
Installing an arm64 Linux VM
From the main UTM application window, choose Create a New Virtual Machine to start the virtual machine creation process.
Click on the Virtualize button.
Click on the Linux button.
Click on the Browse button and select the ISO image file you previously downloaded.
Once selected, click on the Continue button.
In the next screen, you can choose the amount of memory and CPU cores that are going to be used by the VMn this example we will select 4 GB of RAM and 2 CPU cores. Once you’ve made these selections, click on the Continue button.
In this screen, type the storage reserved for this virtual instance (in this example we chose 64 GB), then click Continue button.
The next screen is about shared directories, which we will not be using for the purposes of this demonstration. Click on the Continue
In the last screen, UTM shows a summary of the selected options, letting you type a name for this virtual machine. Click the Save button when finished.
Booting up the Linux VM for the first time
You can now click on the ‘play’ (▶️) icon to launch the virtual machine.
When launching the virtual machine for the first time, the installation program will start. The first screen asks to select an option, make sure to choose the option which starts with Install, using the up arrow keys and pressing Enter key when it is highlighted.
The next screen asks for region and localization options. You can use the mouse on this screen. Let’s choose English as our language on the left, and English (United States) for localization on the right.
The next screen allows you to review your selections and change them in the same section. Click on the Installation Destination button.
Then, select the 64 GB disk, which should be the only one, then click the Done button.
Once you click the Done button, the program returns to the previous screen, click the Root Password button.
In this screen, type your desired password twice for confirmation, click the Done button once finished.
Once you click the Done button, the program returns to the previous screen, now click the User Creation button.
Fill in your user’s full name, username, and password, and confirm the password.
Check the Make the user administrator and Require a password to use this account options. Then click on the Done button.
Once you click the Done button, the program returns to the previous screen, and at this point, you can click on the Begin Installation button.
The installation process lasts about 10-20 minutes depending on your system resource capabilities and utilization. When finished, click on the Reboot System button.
The system will reboot, and after booting will show a welcome screen. Click on your username button and type your password (the one you chose for your user – NOT the one you chose for root!) to login.
If your system doesn’t show a welcome screen, and you see the installation screens, don’t worry, you need to eject the ISO image. All you have to do is to locate a CD or DVD icon up in the top right of the window, click on it and select the CD/DVD ISO, then click on the “Eject” option, and then press the restart button (orange arrow).
Once you have logged in, open the terminal application to start using singularity. To do this, click on the Activities button located at the top left corner of the screen and type terminal in the search box. Then click on the Terminal icon.
Installing the prerequisites
Install the prerequisites for SingularityCE, as follows:
sudo dnf install epel-release
This requires sudo, and will therefore ask you for your user’s password. (Once again, the user’s password, not root’s password.)
Now it’s time to install SingularityCE itself!
sudo dnf install singularity-ce
You can validate that Singularity has been successfully compiled & installed by running singularity –version, whose output should look something like this:
$ singularity --version
singularity-ce version 3.11.0-1.el9
Creating & running your first container
To make sure our installation of SingularityCE was successful, let’s create & run our first container. We can do this as follows:
singularity run library://lolcow
This should download the latest lolcow container image from the Singularity Container Library and run it. The output should look something like this:
$ singularity run library://lolcow
INFO: Downloading library image
86.9MiB / 86.9MiB [=========================================] 100 % 7.5 MiB/s 0s
< Fri Mar 10 09:46:31 PST 2023 >
Congratulations! You have successfully installed SingularityCE on a Linux virtual-machine running on an Apple Silicon Mac!