Renamed /usr on Mac OS X ---> panic

Alec Jacobson

July 13, 2012

weblog/

I recently got a new mac and issued (like a baboon):
sudo mv /usr /usr_off
I immediately noticed that nearly everything in my computed stopped working. I could cd around but even ls produced:
Illegal instruction 4
errors. Of course I tried renaming the folder back but sudo and mv also produced this error. I started freaking out when I tried to connect to a different mac and the whole thing froze. When I restarted I immediately got a kernel panic:
... Process 1 exec of /sbin/launchd failed ...
Booting in "Safe mode" (holding SHIFT) did not work. The solution was to boot holding ALT and choose Recovery HD (luckily this exists because my MacBook Air has no DVD drive). After choosing the language and choosing Reinstall Mac Os X I was able to choose Terminal from the top menu bar. Here I could (scarily) issue:
cd /Volumes/Macintosh\ HD
mv /usr_off /usr
without ever giving a password. I restarted and everything is back to normal.