6

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 the export 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).

5
  • Have you rebooted? What does running who or whoami return in a terminal?
    – terdon
    Sep 18, 2013 at 19:24
  • @terdon yes. The old username is outputted by those commands.
    – dfernan
    Sep 18, 2013 at 19:27
  • 1
    Apple document on the subject: discussions.apple.com/docs/DOC-3872
    – Tim
    Sep 18, 2013 at 19:31
  • @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.
    – dfernan
    Sep 18, 2013 at 20:17
  • 1
    There'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. Sep 18, 2013 at 23:28

3 Answers 3

11

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

  1. Rename the home folder.
  2. 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.

  1. 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
      
  2. 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 administer Accounts.

    • 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.

0

Your change is superficial : you also have to rename your user folder. While it is pretty easy to change your computer name on OS X, OS X does not natively handle changing your username, the solution is pretty hackish. In addition to what you have done, you have to create a new user with admin right (name it whateever you want as it would be a temporary account), login in this user, then change the name of your other admin folder (the old one). The problem is that some software rely on absolute path and they won't now where are all the files they created once you have rename your user folder. For instance, I lost all of my vmx and vmdk files as well as my calibre library and was worried at first when I rebooted (I thought I lost everything the first time OS X rebooted, i.e., the time OS X makes the correspondence between the folder of my admin user and the admin account himself).

To answer your question : If you do not want to go through this, you could, in your PS1, remove \u and just type your username in plain text, make this hack an exception (only for the local host as it won't change) so that when you connect to an other computer (with ssh for instance) the correct username will be displayed.

Edit thanks to RobertL's remark: What I did :

1) RobertL's step 2

2) Rename my user folder within finder (in finder menu bar : Goto--> computer --> macintosh HD (or the name of your drive) --> users --> right click on my user --> read informations (or cmd + i) --> rename in the box at the bottom.

1
  • Respectfully, it seems you may be spreading unwarranted fear because you failed on this task and you don't know why. You mention "hackish", "undesirable changes", "losing files", etc -- yet you give no concrete explanations as to why. Did you create the new admin account with the same name that you wanted to change to? Your experience is valuable and it would be good to know more about why the process failed for you, but you didn't mention the steps necessary to complete the task, nor all the steps you took. I believe this answer is incomplete.
    – RobertL
    Oct 26, 2015 at 23:27
0

Use the Advanced Options menu of User & Groups within Mac OS X System Preferences

How?

When you are in User & Groups hover above the username you like to change and press at the same time Control and left click on your mouse pad. This will display the "advanced options" menu point.

In this menu you can safely change your local username to whatever you like, without any directory renaming or moving and/or typo problems when you try to do that.

Background

A username is mapped again id within "/etc/passwd", and when you rename a User you change the mapping of "ID -> Number" against "Username -> Text".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .