Over the years, I’ve struggled with various operating systems and hardware. I’ve installed Ubuntu on old Mac laptops, only to have them fail due to motherboard issues. Fortunately, I managed to recover another laptop and reinstall Mac OS on it. I also tried Ubuntu on an HP laptop but eventually went back to Windows. I even bought a Framework laptop, but after struggling to get Ubuntu working properly, I decided to return it. I’ve experimented with Parallels, but it often crashes on my old Macs. Only thing that worked was using xfce on EC2 instances. But I wanted it to be fast - as if it was a local machine.
As a developer, finding a stable and efficient setup with Ubuntu has been a challenge. Virtual Box will not install on any of my Macs. Even VS Code crashes when connected to EC2 instances. Despite my best efforts, every approach I’ve tried so far has failed.
Lima is a tool that allows you to run Linux virtual machines (VMs) on macOS for development purposes. It provides a lightweight and efficient way to set up and manage Linux environments on your Mac.
In this article, we will create a Ubuntu virtual machine on M1 Mac mini (2020) Sonoma 14.1.1. It only has 8 GB memory. For quick experimentation purposes, this will work. Install Lima by following the instructions on its home page.
You cannot create any folder from your anywhere on your machine:
You have to be inside the .lima folder that Lima created:
Let’s see file sharing in action between the Mac and Ubuntu VM:
You can access the shared directory on the host macOS at: /Users/your-username/.lima/vm-name/
View this file on VM:
I have two terminals open, the terminal with prompt bparanj@lima-ubuntu is the VM shell prompt and all commands are executed inside the VM. Another terminal has my Mac prompt. From this prompt I can run:
to view the files in Mac finder.
You will get an error if you execute that command inside the VM: