Troubleshooting Slicer for Mac¶
Check or repair a VM disk image¶
If your VM crashes, the Mac sleeps at the wrong time, or slicer-mac is killed before the guest shuts down cleanly, the VM disk image may need a filesystem check.
Install e2fsck via Homebrew. The formula isn't linked onto your PATH, so call it by its full path:
brew install e2fsprogs
E2FSCK=$(brew --prefix e2fsprogs)/sbin/e2fsck
Stop Slicer for Mac, then check the filesystem in read-only mode:
cd ~/slicer-mac
$E2FSCK -v -n ./slicer-1.img
If errors are found, repair them:
$E2FSCK -f ./slicer-1.img
slicer commands fail with 401 Unauthorized¶
If Slicer for Mac isn't running, its socket at ~/slicer-mac/slicer.sock doesn't exist. The CLI then falls back to http://127.0.0.1:8080, and if another program is listening on that port, you'll see an error such as:
Failed to fetch VMs: status 401 Unauthorized: unauthorized
Check that the daemon is running, i.e. with ls ~/slicer-mac/slicer.sock, and start it again if not. See Start the daemon.
No Internet or LAN access from the VM¶
One failure mode on macOS is that the VM networking gets stuck on the wrong subnet because the host-side vmnet state becomes stale.
If you also run Docker Desktop, first check that it is using Docker VMM mode. That is the supported way to run Docker and Slicer together without subnet conflicts. See Use Docker from macOS via a forwarded socket.
You may notice one or more of the following:
slicer vm listshowsslicer-1on192.168.64.2, but the VM cannot reach192.168.64.1- the host shows a stale
bridge100interface on192.168.65.1 - DNS and Internet access fail inside the VM even though the Mac itself is online
The symptom is that the VM has no Internet or LAN access. The cause is that the VM networking is stuck on the wrong subnet.
In this case, the recovery that has worked reliably is:
- rewrite the stale wrong subnet in the vmnet state from
192.168.65back to192.168.64 - clear the DHCP lease database
- remove the generated vmnet state so macOS rebuilds it
Recovery steps¶
Stop Slicer for Mac and any other local VM tooling you were using first.
pkill -f slicer-mac || true
osascript -e 'tell application "Docker" to quit' || true
Remove any stale host bridge created for the shared vmnet range:
sudo ifconfig bridge100 destroy 2>/dev/null || true
If the stale vmnet state shows 192.168.65 where you expect 192.168.64, rewrite it first:
sudo sed -i '' 's/192\.168\.65/192.168.64/g' \
/Library/Preferences/SystemConfiguration/com.apple.vmnet.plist
Back up and remove the DHCP lease database:
sudo mv /var/db/dhcpd_leases /var/db/dhcpd_leases.bak.$(date +%s)
Back up and remove the generated vmnet state file:
sudo mv /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist \
/Library/Preferences/SystemConfiguration/com.apple.vmnet.plist.bak.$(date +%s)
Start Slicer for Mac again:
cd ~/slicer-mac
./slicer-mac up
Verify the fix¶
Confirm the host bridge and VM gateway were recreated correctly:
ifconfig -a | grep -E '^(bridge|vmenet)'
slicer vm list
slicer vm exec slicer-1 -- ping -c 2 192.168.64.1
If the VM can reach 192.168.64.1 again, the stale state has been cleared.
What changed¶
These are the only host-side changes made by the recovery process:
- removed the stale
bridge100interface if it existed - rewrote the stale vmnet subnet from
192.168.65to192.168.64 - removed
/var/db/dhcpd_leasesso stale leases would not be reused - removed
/Library/Preferences/SystemConfiguration/com.apple.vmnet.plistso macOS could recreate vmnet state
Notes¶
bridge0is usually the macOS Thunderbolt Bridge and is unrelated to this issue- if you also run Docker Desktop, restart Slicer for Mac first, then confirm networking works before bringing Docker back up