Mastering Container Development on Mac: Introduction to lima-vm/lima


Mastering Container Development on Mac: Introduction to lima-vm/lima

lima-vm/lima

2025-11-09

Lima, short for Linux virtual machines, is a tool designed to run Linux virtual machines (VMs) on macOS, similar in concept to WSL 2 on Windows. Its main focus is on creating environments specifically for running containers (like Docker or containerd).

For a software engineer using macOS, Lima is incredibly useful for several reasons

Linux Environment Parity
It allows you to develop and test your applications in a genuine Linux environment right on your Mac. This is crucial for applications that are designed to be deployed on Linux servers, helping you catch OS-specific issues early.

Container Runtime
Lima integrates well with container runtimes like containerd (which it supports by default) and Docker. This means you can run Linux containers natively, which is often faster and more resource-efficient than running Docker Desktop's built-in VM.

Seamless Integration
It automates key features that make working with the VM hassle-free

Automatic File Sharing
Your macOS project directories can be automatically shared with the Linux VM. No more complex manual configurations!

Automatic Port Forwarding
Services running inside the VM (e.g., a web server on port 8080) are automatically accessible from your macOS host machine.

Lightweight and Open Source
Lima is a lightweight, open-source alternative that utilizes QEMU for virtualization, giving you more control and transparency compared to some proprietary solutions.

In short, Lima makes it easy to have a fast, native-feeling Linux environment for containerized development on your Mac.

The easiest way to install Lima on macOS is by using Homebrew.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install lima

Once installed, you can start your first VM. Lima uses "templates" for configurations. The simplest way is to use the default template

limactl start

This command will

Download a suitable Linux image (usually a recent Ubuntu LTS or similar).

Create a VM configuration based on the default settings.

Start the VM using QEMU.

Set up file sharing and port forwarding.

The first time you run this, it will take a moment to download the image.

Once the VM is running, you'll primarily interact with it using limactl shell or by defining custom configurations.

To connect to your running Lima instance (the default one is usually named default)

limactl shell

Now you are inside the Linux VM and can use standard Linux commands

$ limactl shell
> pwd
/home/lima
> ls -l /tmp/lima
total 0
# You are now in a Linux shell!

To exit the VM shell, just type exit.

Since Lima often comes pre-configured with containerd, you can run a container directly.

$ limactl shell
> sudo crictl pull docker.io/library/hello-world
> sudo crictl runp --config /dev/null --hook-config /dev/null --runtime /usr/local/bin/containerd-shim-runc-v2 hello-world

Note: If you prefer Docker, you can initialize a VM specifically for it. Many users combine Lima with Colima (brew install colima), which uses Lima to provide a full Docker environment.

Lima allows you to define a YAML configuration file to customize the VM's resources, operating system, and shared directories.

Let's create a file named my-lima.yaml to run a Fedora VM with more RAM

# my-lima.yaml
arch: "x86_64"
memory: "4GiB" # Allocate 4GB of RAM
cpus: 4         # Use 4 CPU cores
images:
  - location: "https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.5.2111-20220316.0.x86_64.qcow2"
    arch: "x86_64"
    # Note: Use a more up-to-date image/distro if available, Fedora or recent Ubuntu are common.
mounts:
  - location: "~" # Share the entire macOS home directory
    writable: true

Then, start the VM with this configuration

limactl start my-lima.yaml --name=fedora-dev

You can then shell into it with

limactl shell fedora-dev

This flexibility is great for engineers who need to test on specific Linux distributions or require more resources for build processes.

I hope this gives you a clear understanding of how Lima can streamline your containerized development on macOS!


lima-vm/lima




A Developer's Toolkit: Navigating the jaywcjlove/awesome-mac List

The awesome-mac repository is essentially a curated list of high-quality macOS applications, categorized for easy browsing


Streamlining Hackintosh Setup: A Developer's Look at OpCore-Simplify

OpCore-Simplify is a specialized tool designed to streamline and automate the creation of the OpenCore EFI (Extensible Firmware Interface) configuration for a Hackintosh


Goodbye Browser Warnings: Secure Your Local Development with mkcert

When you're developing a web application, you often want to simulate a production environment as closely as possible. This includes using HTTPS


Dockerized macOS for CI/CD and Cross-Platform Testing

Hey there! As a software engineer, you're probably used to a lot of different development environments. Sometimes, though


Automating Screen Context: Why Every macOS Engineer Needs Peekaboo

Think of it as the bridge between an LLM (Language Model) and what's actually happening on your screen. Whether you're building a coding assistant or an automated QA bot


WaveTerm: Enhancing Software Engineer Workflows with Cross-Platform Terminal Panes

WaveTerm is an open-source, cross-platform terminal designed to enhance productivity, especially for complex or multi-step workflows


The Software Engineer's Secret Weapon for Fast Image Display: SDWebImage

This library is essentially a robust, full-stack solution for asynchronously loading images from the network and managing them efficiently


tldr-pages: Your Command-Line Cheat Sheet for Software Engineers

As software engineers, we frequently interact with the command line. Whether it's git for version control, docker for containerization


From Code to Console: Understanding shadPS4 as a Software Engineer

Let's dive into shadPS4, a PlayStation 4 emulator written in C++, from a software engineer's perspective. This is a fascinating project that offers a lot of learning opportunities and practical insights


Stop Fumbling with Your Phone: A Guide to Seamless Android Control via escrcpy

Think of it as a polished, user-friendly graphical wrapper for scrcpy (the legendary command-line tool for mirroring Android devices). If you've ever struggled with tiny phone screens while debugging or hated switching between your mouse and a physical phone