Skip to main content

Claude Code Unleashed: Safe Permissions with Lima VM

· 2 min read
fr4nk
Software Engineer
Hugging Face

Run Claude Code with --dangerously-skip-permissions safely using Lima VM on macOS.

Install Lima​

brew install lima

Create VM​

# Create VM (uses Apple Virtualization for M-series)
limactl create --name=claude --vm-type=vz --rosetta --set '.mounts=[]' template:ubuntu-lts

# Start VM
limactl start claude

Setup Claude Code (first time)​

# Enter VM
limactl shell claude

# Install Node.js + Claude Code
sudo apt update && sudo apt install -y curl git build-essential
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash -
sudo apt install -y nodejs
npm install -g @anthropic-ai/claude-code

# Set API key
echo 'export ANTHROPIC_API_KEY="sk-ant-xxx"' >> ~/.bashrc
source ~/.bashrc

Usage​

# Enter VM and run Claude
limactl shell claude
claude --dangerously-skip-permissions

Common Commands​

CommandDescription
limactl listList all VMs
limactl start claudeStart VM
limactl stop claudeStop VM
limactl shell claudeEnter shell
limactl delete claudeDelete VM

Mount Folders from Mac​

No folders are mounted by default (configured with --set '.mounts=[]' for complete isolation). To share files, use limactl copy or configure custom mounts in ~/.lima/claude/lima.yaml.

VM Resource Management​

Adjust CPU and Memory​

# Stop VM first (required for CPU/Memory changes)
limactl stop claude

# Edit VM configuration
limactl edit claude

# Or edit config file directly
nano ~/.lima/claude/lima.yaml

Update these values in the config:

cpus: 8          # Change from 4 to 8 cores
memory: "8GiB" # Change from 4GiB to 8GiB
# Start VM with new settings
limactl start claude

Resize Disk​

# Check current disk usage
limactl shell claude df -h

# Stop VM to resize disk
limactl stop claude

# Edit configuration
limactl edit claude
# Change: disk: "100GiB" to "200GiB" (or your desired size)

# Start VM
limactl start claude

View VM Information​

# List all VMs with status and resources
limactl list

# Show detailed VM info including SSH config
limactl show-ssh claude

# Check VM resource usage from inside
limactl shell claude
htop # or: free -h, lscpu

Tips​

  • Use --vm-type=vz for Apple Silicon (faster than QEMU)
  • Use --rosetta for x86 binary support
  • VM broken? Just limactl delete claude and recreate
  • Start with minimal resources (2 CPUs, 4GB RAM) and scale up as needed
  • Disk resize only increases size, cannot shrink