Mac OS X: Terminal Prompt Username
Be brave. This is not a big deal. I'll simplify the article from Apple Support, which is wordy and long and documents every button push.
Summary
- Rename the home folder.
- Update the Account with the new user and home folder names in System Preferences.
Details
Since you're changing system-level info, you need to have admin privileges. Create a new admin account and log in to it. Use a third name, different than the old and new names that you're changing. It's a good idea to have an extra separate admin account anyway.
Rename the home folder.
In
Terminal
issue this command and type your admin password if/when prompted:sudo mv /Users/old_name /Users/new_name
You can verify success by listing the contents of the new folder and seeing your files there.
ls /Users/new_name
Update the OS X account to match the newly renamed home folder in the OS X Preferences.
Go to
Preferences
->Accounts
and click the lock icon to administerAccounts
.On the account you want to rename, control-click and choose advanced options.
Change the Account Name and Home Directory fields to the new desired values.
Comments
-
dfernan over 1 year
I'm using Mac OS Snow Leopard (v10.6.8). I've changed the account name under
System Preferences > System > Accounts > Full Name
. However, that does not change the username on the terminal prompt. That is, by changing theexport PS1
to, for example,\u
, the username remains the old one.I did not rename the home directory under
/Users/username
, but I was hoping it would be possible just to change that particular username on the terminal (I think it is called short name).-
Admin over 10 yearsHave you rebooted? What does running
who
orwhoami
return in a terminal? -
Admin over 10 years@terdon yes. The old username is outputted by those commands.
-
Admin over 10 yearsApple document on the subject: discussions.apple.com/docs/DOC-3872
-
Admin over 10 years@Tim thanks. After reading that article the fear of changing the username from the main admin account popped in. I'm not confident in following that method. I guess Mac OS is just terrible in this regard.
-
Admin over 10 yearsThere's a user name for humans and a user name for machines. The name for machines usually consists only of lowercase ASCII letters, the name for humans can contain almost any printable character including spaces, diacritics, non-Latin letters, etc. You've changed the name for humans, but not the name for machines.
-