Claude Code Unleashed: Safe Permissions with Lima VM
· 2 min read
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
| Command | Description |
|---|---|
limactl list | List all VMs |
limactl start claude | Start VM |
limactl stop claude | Stop VM |
limactl shell claude | Enter shell |
limactl delete claude | Delete 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=vzfor Apple Silicon (faster than QEMU) - Use
--rosettafor x86 binary support - VM broken? Just
limactl delete claudeand recreate - Start with minimal resources (2 CPUs, 4GB RAM) and scale up as needed
- Disk resize only increases size, cannot shrink
