aka. WSL for macOS
https://lima-vm.io/docs/installation/
vm-config-template
# loc: ~/.lima/default/lima.yaml
# template sources: https://github.com/lima-vm/lima/tree/master/templates#readme
# all options example: https://github.com/lima-vm/lima/blob/master/templates/default.yaml
# docs: https://lima-vm.io/docs/
minimumLimaVersion: 2.0.0
vmType: "vz"
networks:
# vzNAT guest ips currently not configurable, macOS host is 192.168.64.1: https://github.com/lima-vm/lima/issues/2700
- vzNAT: true
images:
- location: "https://cloud.debian.org/images/cloud/trixie/20251117-2299/debian-13-genericcloud-amd64-20251117-2299.qcow2"
arch: "x86_64"
digest: "sha512:e5563c7bb388eebf7df385e99ee36c83cd16ba8fad4bd07f4c3fd725a6f1cf1cb9f54c6673d4274a856974327a5007a69ff24d44f9b21f7f920e1938a19edf7e"
- location: "https://cloud.debian.org/images/cloud/trixie/20251117-2299/debian-13-genericcloud-arm64-20251117-2299.qcow2"
arch: "aarch64"
digest: "sha512:5075d49a9a85f29d1ee78302785b0d5270fd22c16ca75b4b280f7f4c240fcd34fdfa22ab15a5457aa14fbdbf36d8c5562d1133709b58fc8efdec40e363eba085"
- location: https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-amd64-daily.qcow2
arch: x86_64
- location: https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-arm64-daily.qcow2
arch: aarch64
mountTypesUnsupported: [9p]
mountType: "virtiofs" # see: https://lima-vm.io/docs/config/mount/#virtiofs
mounts:
- location: "~"
#- location: "{{.GlobalTempDir}}/lima"
# mountPoint: /tmp/lima
# writable: true
# linux
sudo apt install nfs-kernel-server
systemctl enable --now nfs-server
rpcinfo -p | grep 2049
echo "/home/user.linux 192.168.64.1(fsid=0,rw,sync,all_squash,anonuid=501,anongid=1000,no_subtree_check)" >> /etc/exports
sudo exportfs -ra
sudo exports -v
# macOS
LIMA_VZNAT_IP=$(limactl shell default ip -4 addr show lima0 | awk '/inet[[:space:]]+/ { sub(/\/[0-9]+$/, "", $2); print $2 }')
sudo mount -t nfs -o vers=4,resvport,nfc "${LIMA_VZNAT_IP}$:/home/user.linux" /Users/user/Desktop/test
rpcinfo -p "${LIMA_VZNAT_IP}"
showmount -e "${LIMA_VZNAT_IP}"
nfs mount script
#!/bin/bash
set -euo pipefail
set -x
if [ ! "$(id -u)" -eq 0 ]; then
echo "Not running as root, exiting."
exit 1
fi
export LIMA_PROFILE='default'
export PATH="${PATH}:/opt/homebrew/bin/"
function limactl(){
su - "${SUDO_USER:-user}" -c 'exec limactl "$@"' -- "$@"
}
export -f limactl
limactl start ${LIMA_PROFILE}
LIMA_VZNAT_IP=$(limactl shell ${LIMA_PROFILE} ip -4 addr show lima0 | awk '/inet[[:space:]]+/ { sub(/\/[0-9]+$/, "", $2); print $2 }')
MOUNT_POINT="/Volumes/LIMA"
NFS_MOUNT_PATH=$(showmount -e "${LIMA_VZNAT_IP}" | grep '192.168.64.1' | head -n1 | awk '{print $1}')
if [ ! -d "${MOUNT_POINT}" ]; then
mkdir -p "${MOUNT_POINT}"
fi
if ! mount | grep -q "${MOUNT_POINT}"; then
mount -t nfs -o vers=4,resvport,nfc "${LIMA_VZNAT_IP}:${NFS_MOUNT_PATH}" "${MOUNT_POINT}"
fi