I have done something stupid and need help:
I have 3 external drives attached to my Mac and in an attempt to make the partition names more meaningful, I renamed them using finder/get info. My user account was located on one of these drives, the other 2 are for TimeMachine. Now of course, I cannot access the user account because I forgot to change the path in System Preferences.
By starting in recovery mode I can see the disks, but Disk Utility does not appear to allow me to change the name. Worse still, I cannot remember what the name of my drive that contains the user account should be. I suspect it can be sorted out from the command line, but my skills do not extend that far.
Any chance someone can provide some guidance on how to rename the partition and how to ensure the user account path matches.
Best Answer
The fastest way to solve your problem is probably adjusting the path of your user directory in the yourusername.plist (assuming following current path of your user folder: "/VolumeNameContainingYourUserFolder/Users/yourusername"):
Boot to Recovery Mode.
Open Terminal.app in the menubar (Utilities -> Terminal)
Enter
df
to get the paths/names of your main system volume and the volume containing your user folder. You may have to move around withcd
and check the content of folders withls
if you don't remember the full path of your user folder.Change your working directory to the folder "users" deep inside /private:
List the content of the folder:
Locate your username.plist and convert it to xml:
Then modify the file with vim* (please consult online resources how to work with vim first!)
Modify the string
or
to
in the key "home" at line ~90.
Convert the plist to the original binary format:
enter
exit
and quit TerminalReboot to your main volume, log-in with your account.
Optional: Enable the root user temporarily. Log-out of your user account and log-in with root.
Make any necessary adjustments like renaming the volume containing your user folder (or other user folders) again and changing the path(s) to the user folder(s) of your main user (other users) in System Preferences accordingly. Log-out and log-in with your common user again. Finally disable root.
*: It's much easier to use nano or pico instead of vim, which has two different modes: command mode and insert mode. While testing the solution in a Recovery HD of a virtual machine, i first tried
nano yourusername.plist
, thenpico yourusername.plist
. Both commands gave me an error: Can't find nano/pico. So I decided to use vim, because I was too lazy to find out if nano or pico are present in the Recovery HD at all. You may try nano instead: Use it like an almost common text editor by moving around with the arrow keys and adding or deleting text as usual. After finishing your edit, hit ctrlo to write the changes to disk and ctrlx to exit nano.