How to rebuild a user account in OS X
If a problem with a user account is in the local directory instead of the user account's settings, then rebuilding the account may be the easiest fix.
Problems with user accounts in OS X can happen that result in an account not being able to change configuration options and previously accessible resources. One example of such behavior is an admin account no longer being able to authenticate to access system preference settings even though it is listed as an admin account. Another indicative behavior would be the inability to modify that account's settings, such as its password, log-in window picture, or custom home folder location.
While people might think to look for the root of these problems within the user's folder, they will not find them there. The reason for this is the directory structure that defines the account and its capabilities is stored within the hidden /var/db/dslocal/ directory, unlike other system and user settings that are within preferences folders either in the global or user library folders. Should a setting within these configuration files become corrupted, then the account's stability and capabilities might be compromised.
To address such problems, while some people might try adjusting these account properties manually to preserve the account's integrity and correct the issue, such manipulations can be dangerous if done incorrectly. Incorrect settings to these account files can corrupt the problematic account even further and prevent it from logging in, or even corrupt additional accounts and lead to system instability.
If your account is not working properly and others on the system are functioning just fine, then one simple approach to fixing the issue is to simply wipe and rebuild the directory structure for the account. While this may sound like a daunting task, in OS X it is actually quite easy to do and will not require much use of the Terminal (if any) and not harm any of your user data or settings.
In order to do this, you will need to have at least one working admin account on the system, so if your corrupted account is the only admin account then you will need to first create another admin account. Unfortunately creating a new admin account from within OS X generally requires you have an existing working admin account, but you can overcome this requirement by forcing the OS X setup assistant to run when the system next boots. To do this, follow these steps:
- Reboot into Single-User mode by holding the Command and "S" keys simultaneously at startup.
- Mount the filesystem as read/write by running the following command:
mount -uw /
- Run the following command to delete the OS X setup "complete" flag:
When this is done, enter "reboot" at the command prompt and the system should restart and launch the OS X setup assistant tool, which you can then use to create a new user account (make sure it is a different name than the account you are trying to restore).
Once you have a new admin account on the system, log into it and then go to the Users & Groups (or "Accounts") system preferences, and locate the problematic account. Then click the lock to authorize changes, followed by selecting the account and clicking the minus button to delete it. This action will prompt you to either save the home folder in a disk image, delete the home folder, or don't change it and leave it in its current location.
In this case, you will want to leave the folder as-is, so click the option to not change the home folder, and then continue and click the "Delete User" button.
By performing these actions, you have deleted the user from the system's directory but have kept the user's settings and data intact by preserving its home folder. Now go to the /Macintosh HD/Users/ directory and locate the home folder for the deleted user. If its name includes "(Deleted)" in it, then edit the name and remove these components so it is the same as the short username of the account (renaming the folder will require you authenticate with your new user account).
Once the home folder is renamed, then go back to the Users & Groups system preferences and recreate the account, ensuring you use the same names for both the full and short account names. If done properly, the system will detect the existing home folder that is the same name as the new user account, and will display a warning with the option to use this home folder for the new account. Click "Use Existing Folder" and then the account will be restored.
After the account is set up, try logging out and back into it to test its functionality and ensure it works as expected.