aayush@ate_
cd ../notes
notes

Lima & UTM: CLI vs. GUI Virtualization on macOS – Comprehensive Research Notes

obsidian source → .md

download

aliases:

  • "Lima & UTM: CLI vs. GUI Virtualization on macOS"

Lima & UTM: CLI vs. GUI Virtualization on macOS – Comprehensive Research Notes


******Introduction

  • Lima is an open-source, command-line (CLI) tool for running Linux virtual machines (VMs) on macOS (Apple Silicon/Intel) and Linux. It is designed for developers, especially those working with containers (Docker, Podman, Kubernetes), and automates VM setup, networking, and file sharing.
  • UTM is a graphical user interface (GUI) application for QEMU, enabling easy setup and management of virtual machines for a wide range of operating systems, including Linux, Windows, and macOS. UTM is intended for users who prefer a visual interface and manual configuration.

Installation via Homebrew

Lima

brew install lima
  • Why use Homebrew? Homebrew simplifies installation and updates, integrates well with macOS development environments, and is scriptable.
  • Why choose Lima? Ideal for developers who need fast, automated Linux VMs, container integration, and command-line control.

UTM

brew install --cask utm
  • Why use Homebrew? Homebrew Cask allows for easy installation and updates of GUI apps from the command line.
  • Why choose UTM? Best for users who want a GUI, need to run a variety of operating systems (including desktop environments), and prefer manual setup.

CLI vs. GUI: Lima and UTM Compared

FeatureLima (CLI)UTM (GUI)
InterfaceCommand-lineGraphical
Target AudienceDevelopers, container usersGeneral users, desktop OS virtualization
AutomationHigh (network, file sharing, templates)Manual setup
Container IntegrationBuilt-in (Docker, Podman, Kubernetes)Not built-in
OS TemplatesMany Linux distros, KubernetesUser provides ISO, sets up manually
PerformanceLightweight, fast for dev workloadsHeavier, more general-purpose
Cross-ArchitectureYes (ARM/Intel, via QEMU)Yes, but less automated
Ease of UseCLI-focused, developer-friendlyGUI-focused, user-friendly for beginners

Software Details & Core Features

Lima

  • Type: Command-line tool
  • Platforms: macOS (Apple Silicon & Intel), Linux
  • Architecture Support: ARM and x86 emulation via QEMU
  • Key Features:
    • Automated file sharing (host directories mounted in VM)
    • Automatic port forwarding
    • Deep integration with Docker, Podman, containerd, Kubernetes
    • Preset templates for popular Linux distros and Kubernetes
    • YAML config for resource and settings customization

UTM

  • Type: GUI application (front-end for QEMU)
  • Platforms: macOS (Apple Silicon & Intel), iOS/iPadOS (limited)
  • Architecture Support: ARM and x86 emulation via QEMU
  • Key Features:
    • Visual VM creation and management
    • Supports a wide range of guest OSes (Linux, Windows, macOS, classic Mac OS)
    • Manual configuration of VM resources, storage, and networking
    • Directory sharing between macOS and VM
    • Snapshot and disk image management

Installation & Commands

Lima Basic Commands

  • Start a VM: limactl start <template>
  • List VMs: limactl list
  • Stop a VM: limactl stop <vm-name>
  • Delete a VM: limactl delete <vm-name>
  • Shell into VM: lima <vm-name>

UTM Basic Workflow

  • Install via Homebrew Cask or download from the official site.
  • Launch UTM app, use GUI to create a new VM, select ISO, configure resources, and start the VM.

Use Cases

Lima

  • Development: Fast Linux environments for coding, testing, and running containers.
  • Containerization: Docker, Podman, Kubernetes clusters in isolated VMs.
  • Cross-platform Testing: Run ARM Linux on Intel Macs and vice versa.
  • File Sharing: Edit code on Mac, run/test inside Linux VM with shared directories.
  • Port Forwarding: Expose services from VM to host automatically.

UTM

  • Desktop Virtualization: Run Linux, Windows, macOS, or classic Mac OS in a GUI.
  • Emulation: Test ARM/x86 operating systems.
  • Manual VM Management: Fine-tune VM settings, storage, and networking.
  • File Sharing: Share directories between host and guest OS.

Safety & Security

  • Lima: Sandboxed environments, protected VMs (prevent accidental deletion), configurable file access, open-source and auditable.
  • UTM: Sandboxed VMs, manual control over shared resources, open-source and auditable.

Benchmarks & Performance

  • Lima: Lightweight, fast startup, optimized for development and container workloads, near-native performance for containers.
  • UTM: Heavier, more resource-intensive, suitable for running full desktop environments, x86 emulation slower on Apple Silicon.

Why and Why Not Use Each

Lima

  • Why Use: Automation, container integration, scriptable, efficient for development, easy to manage multiple VMs, integrates with macOS features.
  • Why Not Use: Not ideal for running desktop environments or Windows VMs, CLI-only (less friendly for non-developers).

UTM

  • Why Use: Easy GUI, supports many OSes, flexible for desktop environments, good for beginners, manual control.
  • Why Not Use: Manual setup, slower x86 emulation on Apple Silicon, less automation, not optimized for container workflows.

Research & Community Insights

  • Lima: Widely adopted by developers for local Kubernetes and Docker development. Praised for automation, container tool integration, and developer experience.
  • UTM: Popular for running desktop OSes, recommended for beginners and those who need a GUI. Manual setup is more flexible but less automated.

Lima commands


Here are the essential Lima command codes for installation, VM management, and common usage on macOS. These are ready for your reference or to copy into your notes.


Lima: Essential Commands for macOS

1. Install Lima via Homebrew

brew install lima

2. Start a New Virtual Machine

  • Start with the default template (Ubuntu):
limactl start default
  • Or use a specific template (e.g., Docker, Fedora, Kubernetes):
limactl start template://docker
limactl start template://fedora
limactl start template://k8s
  • List available templates:
limactl start --list-templates

3. Access the VM Shell

lima

This drops you into a shell inside your running VM.[6]


4. Run Linux Commands in the VM

lima sudo apt-get update
lima sudo apt-get install -y <package-name>
lima <command>

Example:

lima neofetch

5. Manage VMs

  • List running VMs:
limactl list
  • Stop a VM:
limactl stop <vm-name>
  • Delete a VM:
limactl delete <vm-name>

6. Container Integration

  • Run a container using containerd:
lima nerdctl run --rm hello-world
  • Run a container using Docker:
limactl start template://docker
export DOCKER_HOST=$(limactl list docker --format 'unix://{{.Dir}}/sock/docker.sock')
docker run --rm hello-world

7. Kubernetes Integration

limactl start template://k8s
export KUBECONFIG=$(limactl list k8s --format 'unix://{{.Dir}}/copied-from-guest/kubeconfig.yaml')
kubectl apply -f <file.yaml>

8. Advanced: Specify VM Type

  • Use Apple’s Virtualization.framework (faster, native on macOS 13+):
limactl start --vm-type=vz --mount-type=virtiofs

9. Check Lima Version

lima --version

After you exit the Lima VM shell, here is how you can start and enter Lima again:

  1. To start the Lima VM (if not already running):

    limactl start default
    

    This starts the VM named "default". If it is already running, this command will just confirm it is running without recreating it[2][6][8].

  2. To open a shell inside the running Lima VM:

    limactl shell default
    

    or simply use the shortcut command:

    lima
    

    Both open a terminal shell inside the "default" Lima VM[6][8].

  3. To exit the Lima VM shell: Inside the Lima shell, type:

    exit
    

    or press Ctrl+D to return to your macOS terminal[9].

  4. To stop the Lima VM when you are done:

    limactl stop default
    

    This cleanly shuts down the VM to free system resources[6][8].


Summary commands for managing Lima VM "default":

ActionCommand
Start VMlimactl start default
Enter VM shelllimactl shell default or lima
Exit VM shellexit or Ctrl+D
Stop VMlimactl stop default

This workflow lets you start, enter, exit, and stop Lima VMs cleanly and easily from the terminal[2][6][8].

Sources [1] Command to exit the ssh session · Issue #3125 · lima-vm/lima - GitHub https://github.com/lima-vm/lima/issues/3125 [2] start | Lima https://lima-vm.io/docs/reference/limactl_start/ [3] Error starting a virtual machine with Lima - trellis - Roots Discourse https://discourse.roots.io/t/error-starting-a-virtual-machine-with-lima/25293 [4] Colima fails to start: FATA[0600] error starting vm: error at 'creating ... https://github.com/abiosoft/colima/issues/905 [5] Keep getting error runing colima FATA[0001] error starting vm https://stackoverflow.com/questions/77195672/keep-getting-error-runing-colima-fata0001-error-starting-vm-error-at-startin [6] lima man | Linux Command Library https://linuxcommandlibrary.com/man/lima [7] Athena on Lima - ATLAS Software Documentation - CERN https://atlas-software.docs.cern.ch/athena/containers/lima [8] limactl man | Linux Command Library https://linuxcommandlibrary.com/man/limactl [9] Tools tools.command_line_interfaces


Tip:
All Lima commands are run from your macOS terminal. You can customize VMs further by editing their YAML config files in ~/.lima/<instance>/lima.yaml.[6]

For more details, visit the

[official Lima documentation][1].