If you disabled FileVault earlier, re-enable it:
Once you have logged out of your primary account and into the temporary administrator account, follow these steps: Reddit·r/MacOShttps://www.reddit.com mac change user folder name
This works. But it works only if you are logged in as another admin user, with no processes belonging to the target user running. It requires a complete logout, a silent login as root or secondary admin, and a prayer. If you disabled FileVault earlier, re-enable it: Once
sudo dscl . -change /Users/oldname RecordName oldname newname sudo mv /Users/oldname /Users/newname sudo dscl . -change /Users/newname NFSHomeDirectory /Users/oldname /Users/newname If you disabled FileVault earlier