LinuxCommandLibrary

lima

Run Linux virtual machines on macOS

TLDR

View documentation for the original command

$ tldr limactl
copy

SYNOPSIS

lima [OPTIONS] <COMMAND> [ARGUMENTS...]

Common Commands:
lima start [INSTANCE_NAME] [OPTIONS]
lima ssh [INSTANCE_NAME] [COMMAND]
lima ls
lima stop [INSTANCE_NAME]
lima rm [INSTANCE_NAME]

PARAMETERS

--debug
    Enable debug logging for more verbose output.

--log-level=LEVEL
    Set the logging level (e.g., 'info', 'warn', 'error', 'fatal').

--name=NAME
    Specify the instance name (e.g., 'default'). Used with commands like start, ssh, stop, rm.

--arch=ARCH
    Specify the architecture of the VM (e.g., 'aarch64', 'x86_64').

--vmtype=TYPE
    Specify the virtualization backend (e.g., 'qemu', 'vz').

--mount=PATH
    (For 'start') Mount a host path into the VM. Can be specified multiple times.

--memory=SIZE
    (For 'start') Set the VM memory size (e.g., '4GiB').

--cpus=COUNT
    (For 'start') Set the number of CPU cores for the VM.

--disk=SIZE
    (For 'start') Set the VM disk size (e.g., '100GiB').

DESCRIPTION

Lima (Linux Machines) is an open-source tool designed to run Linux virtual machines primarily on macOS, providing a lightweight alternative to solutions like Docker Desktop. It leverages QEMU for virtualization and integrates seamlessly with container tools like containerd and its CLI client, nerdctl.

Lima enables developers to have a full-fledged Linux environment, including a functioning containerd runtime, without the overhead or licensing implications of commercial alternatives. It facilitates easy creation, management, and interaction with Linux instances, allowing for shared filesystem mounts with the host and convenient SSH access. Its design focuses on simplicity and compatibility with standard container workflows, making it ideal for local Kubernetes development, testing containerized applications, or simply requiring a native Linux shell on macOS.

CAVEATS

While Lima offers a powerful and flexible environment, users should be aware of a few considerations:

1. Performance: File system sharing (virtiofs) can sometimes exhibit performance limitations, especially with large numbers of small files or intensive I/O operations.
2. Maturity: Being a relatively newer project compared to established VM solutions, it might lack some advanced GUI features or comprehensive integrations found in commercial products.
3. Debugging: Troubleshooting VM-level issues might require familiarity with QEMU or low-level Linux debugging.
4. macOS-centric: While it can run on Linux, its primary design and feature set are optimized for macOS hosts, meaning Linux hosts might find more native alternatives.

YAML CONFIGURATION

Lima instances are highly customizable through YAML configuration files. Users can define parameters like CPU, memory, disk size, mounted paths, and even specify custom cloud-init configurations for initial setup. These configurations allow for precise control over the VM environment and can be version-controlled, facilitating reproducible development environments.

Examples of configuration files can be found in the Lima repository or within the user's ~/.lima/_config/ directory.

INSTANCE MANAGEMENT

Lima supports running multiple named instances simultaneously. This allows developers to manage separate Linux environments for different projects or testing scenarios. Commands like lima ls, lima start, lima stop, lima ssh, and lima rm all accept an optional instance name to operate on a specific VM, defaulting to the 'default' instance if no name is provided.

NETWORK CONFIGURATION

Lima handles networking for its VMs, typically by default using user-mode networking (SLIRP) or, when available, more performant options like VirtioNet and shared network stacks. It supports automatic port forwarding, allowing host ports to be easily mapped to services running inside the VM. Advanced network configurations, such as bridged networking or custom DNS settings, can be configured via the YAML files.

HISTORY

Lima was created by Akihiro Suda, a prominent contributor to the container ecosystem, with the initial public release occurring in 2021. The project emerged from a desire to provide a lightweight, open-source alternative for running Linux container runtimes (specifically containerd) on macOS, circumventing the need for Docker Desktop's bundled VM and its evolving licensing terms.

Its development has been driven by the open-source community, focusing on tight integration with tools like nerdctl and leveraging standard virtualization technologies such as QEMU and virtiofs. Lima quickly gained traction among developers seeking a more transparent and customizable Linux environment for local development and testing of containerized applications and Kubernetes clusters.

SEE ALSO

qemu(1), nerdctl(1), containerd(1), docker(1), multipass(1), podman(1), ssh(1), virtiofsd(8)

Copied to clipboard