Mac OS X freezes while choosing a keyboard after reset Lion back to the Setup Assistant

I have a problem with my MacBook Pro, which runs Mac OS X Lion.

I have reset it back to the Setup Assistant.

After I executed the following commands, I need to select the region when I boot; this works fine, but when I choose the keyboard, the whole Mac gets stuck, and I see the loading icon on the screen. Even if I wait one hour, nothing happens.

$ mount -uw /
$ rm -R /Library/Preferences/
$ rm -R /Users/username/
$ rm /var/db/dslocal/nodes/Default/users/username.plist
$ rm /var/db/.AppleSetupDone

How can I solve this? I have no Mac OS X disc to reinstall Lion.

Can I create a user via the command line, or skip the setup assistant?


Solution 1:

Sounds like a bad install. I suggest booting the computer into the hidden Recovery partition by holding ⌘ Cmd-R at startup and doing an internet recovery system restore. It'll be the second option in the OS X Utilities window that comes up. As long as the iMac is connected to the internet it'll re-download the installer and restore a fresh system to the drive.

If you're trying to bring the MacBook back to the way it was when you purchased it I'd suggest opening the Disk Utility in recovery first and erasing the drive completely. (But only if there's no important data on it!)

Solution 2:

Ok, so I had the same issue on my Mid 2010 MacBook Pro, and I fixed it by holding down shift and booting into safe mode into the setup assistant. It flows smoothly, and before it stopped exactly where you failed at.