macOS에서 리눅스 전용 도구(perf, eBPF, snap, LXD)를 쓰거나 Ubuntu 패키지를 시험하려면 리눅스 커널이 필요하다. Docker Desktop은 컨테이너만 다루고, 일반 VM 소프트웨어는 설치와 파일 공유 설정에 손이 많이 간다. Lima는 명령 한 줄로 Ubuntu VM을 만들고 홈 디렉터리 마운트와 포트 포워딩을 자동으로 설정한다. 이 글에서는 Apple Silicon Mac에서 Lima로 Ubuntu VM을 만들고 쓰는 방법을 정리한다.
설치
Homebrew로 설치한다. VM을 관리하는 명령은 limactl이다.
$ brew install lima
$ limactl --version
limactl version 2.3.0
Ubuntu VM 만들기
Lima는 배포판별 템플릿(template)을 제공한다. Ubuntu는 버전마다 템플릿이 있다.
$ limactl start --list-templates | grep ubuntu
experimental/ubuntu-next
ubuntu
ubuntu-20.04
ubuntu-22.04
ubuntu-24.04
ubuntu-24.10
ubuntu-25.04
ubuntu-25.10
ubuntu-26.04
ubuntu-26.10
ubuntu-lts
이름, CPU 수, 메모리(GiB), 디스크(GiB)를 지정해 VM을 만들고 시작한다. --tty=false를 빼면 설정을 편집할지 묻는 메뉴가 먼저 나온다.
$ limactl start --name=ubuntu --cpus=2 --memory=4 --disk=20 --tty=false template:ubuntu-26.04
...
time="2026-11-26T01:11:05+09:00" level=info msg="READY. Run `limactl shell ubuntu` to open the shell."
$ limactl list
NAME STATUS SSH VMTYPE ARCH CPUS MEMORY DISK DIR
ubuntu Running 127.0.0.1:50430 vz aarch64 2 4GiB 20GiB ~/.lima/ubuntu
첫 생성은 클라우드 이미지를 내려받아 4분 가까이 걸린다. 이미지가 캐시에 남으므로 다시 만들면 40초 안에 끝난다. VMTYPE의 vz는 macOS의 Virtualization.framework를 쓴다는 뜻이다.
VM에 접속하고 명령 실행
limactl shell <이름>은 대화형 셸을 열고, 뒤에 --와 명령을 붙이면 그 명령만 실행한다.
$ limactl shell ubuntu -- grep PRETTY /etc/os-release
PRETTY_NAME="Ubuntu 26.04.1 LTS"
$ limactl shell ubuntu -- uname -srm
Linux 7.0.0-38-generic aarch64
$ limactl shell ubuntu -- whoami
junorion
$ limactl shell ubuntu -- sudo -n true && echo sudo-ok
sudo-ok
VM 안의 사용자 이름은 Mac 사용자 이름과 같고, 비밀번호 없이 sudo를 쓸 수 있다. 자주 쓰는 VM은 LIMA_INSTANCE를 지정해 lima 명령으로 줄여 쓴다.
$ export LIMA_INSTANCE=ubuntu
$ lima uname -m
aarch64
Mac 디렉터리 마운트
기본 설정은 Mac 홈 디렉터리를 VM의 같은 경로에 읽기 전용으로 마운트한다. VM 사용자의 홈($HOME)은 이와 별도인 /home/<사용자>.guest다.
$ limactl shell ubuntu -- mount | grep virtiofs
lima-bca818f01749e2aa on /Users/junorion type virtiofs (ro,relatime)
$ limactl shell ubuntu -- sh -c 'echo $HOME'
/home/junorion.guest
$ limactl shell ubuntu -- touch /Users/junorion/test.txt
touch: cannot touch '/Users/junorion/test.txt': Read-only file system
limactl shell은 Mac의 현재 디렉터리가 VM에 마운트되어 있으면 그 경로에서 시작한다. 현재 디렉터리가 마운트 밖에 있으면 VM의 홈에서 시작한다.
VM에서 파일을 쓰려면 쓰기 가능한 디렉터리를 마운트한다. 설정은 VM을 정지한 뒤 limactl edit으로 바꾼다. --mount-only는 기존 마운트를 지정한 목록으로 바꾸고, :w는 쓰기 가능을 뜻한다.
$ limactl stop ubuntu
$ limactl edit ubuntu --mount-only "~/limademo:w" --tty=false
$ limactl start ubuntu --tty=false
$ limactl shell ubuntu -- mount | grep virtiofs
lima-1af6d2072698cc85 on /Users/junorion/limademo type virtiofs (rw,relatime)
$ cd ~/limademo
$ limactl shell ubuntu -- sh -c "echo from-ubuntu > back.txt"
$ cat ~/limademo/back.txt
from-ubuntu
포트 포워딩
Lima는 VM 안에서 열린 TCP 포트를 감지해 Mac의 127.0.0.1 같은 포트로 자동 연결한다. 별도 설정 없이 Mac 브라우저나 curl로 접속할 수 있다.
$ limactl shell ubuntu -- sh -c "nohup python3 -m http.server 8000 >/dev/null 2>&1 &"
$ curl -sI http://127.0.0.1:8000 | head -2
HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/3.14.4
Mac 포트와 VM 포트를 다르게 연결하려면 생성할 때 --port-forward 8080:80처럼 지정한다.
CPU·메모리 변경
자원도 정지 상태에서 limactl edit으로 바꾼다.
$ limactl stop ubuntu
$ limactl edit ubuntu --cpus 4 --memory 6 --tty=false
$ limactl start ubuntu --tty=false
$ limactl list ubuntu
NAME STATUS SSH VMTYPE ARCH CPUS MEMORY DISK DIR
ubuntu Running 127.0.0.1:50471 vz aarch64 4 6GiB 20GiB ~/.lima/ubuntu
$ limactl shell ubuntu -- nproc
4
Rosetta로 x86_64 바이너리 실행
Apple Silicon의 VM은 arm64라서 x86_64 바이너리를 바로 실행하지 못한다. --rosetta를 켜면 Lima가 Rosetta를 binfmt_misc 인터프리터로 등록한다.
$ limactl shell ubuntu -- sh -c "cd ~ && curl -sO http://archive.ubuntu.com/ubuntu/pool/main/b/busybox/busybox-static_1.37.0-7ubuntu1.1_amd64.deb && dpkg-deb -x busybox-static_1.37.0-7ubuntu1.1_amd64.deb bb && ./bb/usr/bin/busybox uname -m"
sh: 1: ./bb/usr/bin/busybox: Exec format error
$ limactl stop ubuntu
$ limactl edit ubuntu --rosetta --tty=false
$ limactl start ubuntu --tty=false
$ limactl shell ubuntu -- cat /proc/sys/fs/binfmt_misc/rosetta | head -2
enabled
interpreter /mnt/lima-rosetta/rosetta
$ limactl shell ubuntu -- sh -c "cd ~ && ./bb/usr/bin/busybox uname -m"
x86_64
Rosetta가 x86_64 명령을 번역하므로 x86_64 바이너리 안에서는 uname -m도 x86_64로 보인다.
정지와 삭제
$ limactl stop ubuntu
$ limactl list ubuntu
NAME STATUS SSH VMTYPE ARCH CPUS MEMORY DISK DIR
ubuntu Stopped 127.0.0.1:50527 vz aarch64 2 4GiB 20GiB ~/.lima/ubuntu
$ limactl delete ubuntu
limactl delete는 ~/.lima/ubuntu의 디스크 이미지까지 지운다. 실행 중인 VM은 -f를 붙여야 지워진다.
명령 요약
| 작업 | 명령 |
|---|---|
| 생성·시작 | limactl start --name=<이름> template:ubuntu-26.04 |
| 목록 | limactl list |
| 셸·명령 실행 | limactl shell <이름> [-- 명령] |
| 설정 변경 | limactl edit <이름> --cpus/--memory/--mount-only/--rosetta |
| 시작·정지 | limactl start <이름> / limactl stop <이름> |
| 삭제 | limactl delete [-f] <이름> |
| 템플릿 목록 | limactl start --list-templates |
주의사항
- 홈 디렉터리 마운트와 겹치는 하위 디렉터리를
--mount로 추가하지 말 것. Lima가overlapping mounts are not supported경고를 낸다. 홈 대신 작업 디렉터리만 마운트하려면--mount-only를 쓴다. - 소스 빌드는 VM의 홈(
/home/<사용자>.guest)에서 할 것. VM의 디스크는 ext4이고, Mac의 APFS는 기본으로 대소문자를 구분하지 않는다. 리눅스 커널 소스처럼 대소문자만 다른 파일이 있으면 Mac 디렉터리에서 문제가 생긴다. - VM 안에서 다시 VM을 띄우는 작업은 계획하지 말 것.
vzVM에는/dev/kvm이 없다. 그래서 LXD도instance_types에container만 보고하고lxc launch --vm을 쓸 수 없다. 컨테이너는 문제없이 동작한다. - Rosetta를 x86_64 VM 대용으로 생각하지 말 것. Rosetta는 사용자 공간 바이너리만 번역한다. 커널과 커널 모듈은 계속 arm64다.
마무리
Lima는 limactl start 한 줄로 Ubuntu VM을 만들고 마운트와 포트 포워딩을 자동으로 처리한다. VM 안에서 LXD를 설치하면 여러 Ubuntu 버전을 컨테이너로 시험할 수 있다. 방법은 LXD로 Ubuntu 컨테이너 사용하기에 정리했다.