How to repair damaged admin account

accountsadministratorapple-id

My friend just played around with the admin account settings of her MacBook Pro and now the account is damaged She cannot access the desktop; after entering the password just the desktop background appears and she cannot do anything.

Below is exactly how she damaged it.

She wanted to change her username.
She went into System Preference -> Users & Groups, and entered the "Advanced Options" of the admin account.

enter image description here

She disregarded the "WARNING".
She changed the account name , full name and Apple ID to another E-mail

What should she do now to fix that?

Best Answer

By deleting a special file you can re-run Setup Assistant to create a new admin user.

Removing .AppleSetupDone to re-run Setup Assistant:

To remove this file, you have to boot to single user mode by pressing S while booting. After a few moments, you'll see the Mac boot to the command line.

Check the file system and mount your main volume in read/write mode

/sbin/fsck -fy
/sbin/mount -uw /

With the filesystem mounted and accessible, it's time to remove the file so OS X will re-run Setup Assistant:

rm /var/db/.AppleSetupDone

Reboot your Mac with

reboot

If El Capitan is installed you may have to disable SIP before you can remove the file.

After rebooting the Setup Assistant will create a new local admin user without iCloud integration and setup your system. Choose a user name not used previously.

Now open System Preferences -> Users & Group, enter the "Advanced Options" of the admin account and restore the previously working settings of the first admin user.

Log-out of the new admin account and log-in as old admin user and check if it is working. Open System Preferences -> Users & Group and remove the new admin user.