As you may know when you change your username in OS-X you must change the home directory as well to match the new username (https://support.apple.com/en-us/HT201548).
Now in El Capitan when you change the home directory you get an extra “/” at the end of the username and it is going to be in your $HOME environment variable as well: /Users/myusername/. This information is provided by launchd. It can be changed from .profile or .bash_profile but it won’t take effect everywhere in the system but in terminal.
This doesn’t look like a big issue at the first glance however it might be. Some applications refuse to run if there is a discrepancy between $HOME env variable and value returned by NSHomeDirectory().
I had issues running Tunnelblick. “The checks are performed to help prevent attacks like the Bourne-Again Shell (Bash) Remote Code Execution Vulnerability.”
Luckily there is an easy fix.
- Create a new directory under /Users/temporarily
- Create a new admin user if you don’t have one already
- Sing out from the user with issues and log in to the other user
- Go to System Preferences -> Users&Groups -> hit the lock icon -> right click on the troubled user name then Advanced Options
- Choose the directory you’ve created in step 1 (/Users/temporarily) -> click OK
- Click the lock again to lock it
- Right click again on the troubled user name and click Advanced Options -> Type in the correct home directory without the forward slash at the end /Users/username -> click OK
- Login with the user you had issues and you should be done, and you can remove /Users/temporarily directory
I want to thank for the help of the Tunnelblick debugging the app and Apple’s customer care who confirmed the bug and helped with the work around. Apple shall come up with a bug fix in their next release.
2 thoughts on “OS-X – change username/home directory – El Capitan”
Wow, thanks Laszlo! I had the exact same problem–El Capitan and Tunnelblick and all–and honestly didn’t expect to find such a perfect solution. Thank you so much!
I’m glad it helped! 😉