Friday, October 30, 2015

Fix Mac boot hanging due to missing var/folders

Although /var/folders" (or "/private/var/folders") is "per-user temporary files and caches", and its content can be cleaned by system at any time, but the var/folders itself cannot be deleted. After I accidentally deleted var/folders fold from my mac, and the box could not reboot successfully.  

By restarting the mac in single user mode (pressing Command+S) in unix shell, I tried to add the var/folders back, however, the mkdir failed as the folder is mounted as readonly. Unfortunately, chflags does not work in this case.

The rescue is
mount -uw

which will mount the folder as read-write. After that, mkdir can successfully create the var/folders again, and the mac can reboot properly. The strange thing is you can delete var/folders using Finder, but you cannot put it back or create a new var/folders folder using Finder.

No comments:

Post a Comment