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




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


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


A Single Codebase for All Platforms

Flutter is an open-source UI software development kit created by Google. It's used to build natively compiled applications for mobile (Android


Unleashing Local AI: Integrating k2-fsa/sherpa-onnx Across 12 Programming Languages

Simply put, it's an open-source, real-time speech and audio processing toolkit built on top of the next-generation Kaldi framework and leveraging ONNX Runtime for high-performance


A Software Engineer's Guide to LeaningTech's WebVM

Leaning Technologies' WebVM is a groundbreaking technology that allows you to run a full Linux-like virtual machine entirely within your web browser


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


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


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


Beyond Storage: Optimizing Your Development Environment via Mole

You're asking about Mole (tw93/Mole), a specialized shell script designed to deep clean and optimize macOS. For us engineers


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