11 Replies Latest reply: Sep 16, 2012 3:37 AM by chylu
macTATAAbox Level 1 Level 1 (0 points)

I want to change the name of my home directory, which is also known as the "short" user name in OSX Lion. Apple Support provides a guide for changing the short name, but when I try to follow the instructions in the guide, my Mac does not do what the instructions say it should do. As a result, I can not change the short name.

 

The guide says:

For Mac OS X v10.5 or later

  1. Enable the root user.
  2. Log in as root.
  3. Navigate to the /Users folder.
  4. Select the Home folder with the short name you want to change, and rename it just like you would rename any folder. Keep in mind that the shortname must be all lowercase, with no spaces, and only contain letters.
  5. Use the Users & Groups pane (Accounts pane in Mac OS X v10.6.8 or earlier) in System Preferences to create a new user with the Account name or Short Name that you used in the previous step.
  6. Click OK when "A folder in the Users folder already has the name 'account name'. Would you like to use that folder as the Home folder for this user account?" appears. Note: This will correct the ownership of all files in the Home folder, and avoid permissions issues with the contents.
  7. Choose Log Out from the Apple menu.
  8. Log in as the newly created user. You should be able to access all of your original files (on the desktop, in Documents, and in the other folders of this Home).
  9. After verifying that your data is as expected, you can delete the original user account via the Users & Groups pane (Accounts pane in Mac OS X v10.6.8 or earlier).
  10. Disable the root user.

I can get as far as item #5, but then things don't go as they are supposed to. After sigining in as root, and changing the name of the home folder to the new name (steps 1-4), I open the Users & Groups pane of the System Preferences, and create a new user. In the "Account name" field, I enter the new folder name (same name used in step #4), as instructed. Here is where the instructions are incorrect. I never see the message described in step #6: "A folder in the Users folder already has the name 'account name'.". Instead, when I type the new name of the folder (the new short user name) into the "Account name" field, an error message appears, in red text, below the Account name field, which says:

 

"Name is used by another user."

 

There is no button to click 'OK' to make this error message go away. And there is no way to leave the field -- If I click anywhere else in the pane the cursor immediately returns (automatically) to the Account name field. Essentially, it is impossible to create the account as long as the error message remains. There is therefore no way to change the short name to the name of the folder I changed in step #4!

 

What gives? The behavior of the Systems Preferences "Users & Groups" pane does not agree with the behavior described in the guide provided by Apple, which is supposed to pertain to Lion, which I am using (10.7.3). This is on a 2012 Macbook Pro.

 

HELP?

 

M


MacBook Pro, Mac OS X (10.7.3)
  • 1. Re: Guide to change home dir name is wrong!
    Shootist007 Level 6 Level 6 (16,640 points)

    Just create a New User with the name you want then copy your files over to that new user account then once you know you have everything delte the original user.

  • 2. Re: Guide to change home dir name is wrong!
    gracoat Level 3 Level 3 (660 points)

    Or you can just change the users "Home directory is located here" attribute.  (NFSHomeDirectory)

    You'll need to make sure that the content of this new folder has all your home folder stuff in it!

     

    Just create a new folder in the /Users folder.  Call it whatever you like.

     

    Copy everything from your home folder to this new folder.

     

    In terminal:

     

    sudo dscl . -write /Users/*your_user_shortname* NFSHomeDirectory /Users/*your_new_folder*

     

    Careful though...  Messing with sudo in the terminal can be ugly.

    If you run into issues......  Theyr'e EXTREMELY hard to troubleshoot on this forum.

    Enjoy!

    -Graham

  • 3. Re: Guide to change home dir name is wrong!
    Eric. Level 6 Level 6 (12,260 points)

    Are you just trying to change the name of the Home directory? Or are you trying to change both the usernames (Short and Full) and Home directory?

     

    The guide is really about the latter, changing both names and home directory. So the guide is correct for that purpose.

     

    If you just want to leave the names, but rename the home directory, I *believe* the following will work, but I've never tried when my Home directory doesn't correspond to my shortuser name. (I have used it to shift Home directories to another HD.)

     

    - Follow steps #1-4. Pay attention to the remarks in #4 about the name of the Home directory

    - Open Users & Groups System Preferences.

    - Authenticate (click the lock) if necessary

    - In the list/pane on the left, right-click the user whose Home directory you want to change, and select "Advanced Options"

    - Look for "Home directory". Next to the field (that happens to show the path to with the old Home directory name), click the "Choose..." button.

    - Select your renamed Home directory in the resulting pane. (If you're not used to Unix paths, using "Choose..." should result in correct syntax.)

    - Click OK.

    - Exit System Preferences and logout

    - Login with your account to test the changes.

     

    This is the GUI way to make the changes that correspond to the terminal commands given by gracoat.

  • 4. Re: Guide to change home dir name is wrong!
    macTATAAbox Level 1 Level 1 (0 points)

    @ Shootist007

    How will moving the contents of my current home directory to a different home directory affect backups in Time Machine? Will doing that cause TM to run a complete back up on the new User, instead of the incremental backup it would normally do with my data? I want to avoid that if I can, which is why I tried to follow Apple's recommended method.

  • 5. Re: Guide to change home dir name is wrong!
    macTATAAbox Level 1 Level 1 (0 points)

    @ gracoat

    Same question as above.

  • 6. Re: Guide to change home dir name is wrong!
    macTATAAbox Level 1 Level 1 (0 points)

    Eric.wrote:

    > Are you just trying to change the name of the Home directory? Or are you trying to change both the usernames

    > (Short and Full) and Home directory?

     

    I just want to change the name of my Home directory, which is also used as a user's Account name, and referred to as the user's "short name". I do not need to change the user's "full" name.

     

    Eric.wrote:

    > The guide is really about the latter, changing both names and home directory. So the guide is correct for that

    > purpose.

     

    I think you are confusing the particular guide in question with a different one. The guide I am referring to is located here:  http://support.apple.com/kb/HT1428

     

    The title of the guide is: "OS X: How to change user account name or home directory name." And the guide description is clearly about just that: changing the Account name (which is exactly the same thing as the Home directory name and short name). So, no, the guide I am using is not for changing the Full name.

     

    According to the guide: "Once the user has been created, the account name (or short name) cannot be changed in the Users & Groups pane of System Preferences." Unless Apple is mistaken, you can not do what you suggest. However, I will try it if doing what gracoat suggests does not work.

     

    Thanks!

    M

  • 7. Re: Guide to change home dir name is wrong!
    gracoat Level 3 Level 3 (660 points)

    Time machine runs as a root process.  It doesn't care what the data looks like on your hard drive as long as you're not running OS X Server.

    So when Time Machine runs it's backup, it'll record the changes as you made them.  Including, the movement of all your home folder items, and the change to your user account.  (the remapping of your home directory)

    If you decide that you don't like it, open up time machine and restore back to yesterday's state, and voila!  Time Machine will work it's magic just fine.

     

    -Graham

  • 8. Re: Guide to change home dir name is wrong!
    Eric. Level 6 Level 6 (12,260 points)

    Look I wasn't confused about the Article, in fact you pasted the instructions. Those instructions will only work if you change both the short user name that matters for login and the home directory. Otherwise if you just try to create a new user with the same short name as before, surprise you get the error you're facing.

     

    Again I posted instructions for changing the path to your home directory after you've renamed it. You don't need to create a new user as per the article's instruction of you don't change the short name.

  • 9. Re: Guide to change home dir name is wrong!
    Eric. Level 6 Level 6 (12,260 points)

    P.s. I'm on an iPhone so I can't edit. You've emphases step #5, which I'm saying you can't and shouldn't do. If you at the steps I posted I said follow Apples steps 1-4, at the point I've given alternative step from there onward. You need to modify the path/location to the renamed home directory. Don't try to create a new account.

  • 10. Re: Guide to change home dir name is wrong!
    macTATAAbox Level 1 Level 1 (0 points)

    Okay, I agree that Apple's guide for changing the short name also involves changing the full name. The name of the guide is a little misleading, as it specifies only the short name (i.e. account name). The guide does say to create a new user account (which requires a new full name). This seems to be an unnecessary step.

     

    In any case, I followed the steps you recommended, with a slight difference: instead of changing the name of the original folder, I created a new folder and copied the contents of the old one to the new one (using cp -pR in a terminal). I wanted to keep the old folder intact, and make a copy, in case something went wrong (even though I backed up my Mac first. I guess I'm overly cautious.).

     

    This appears to have done what I wanted, When I log in, my home directory is now the new folder.

     

    To give a little more background: the reason I wanted to change the home directory name was that the original name included a space (i.e. white space). The space was inserted when I used Migration Assistant to move my data to a new laptop. I wanted to keep my user name and home directory name from my old laptop, but during the migration process I somehow managed to end up with a home directory with a space and a "1". For example, if the old home directory name as "bob", the Migration Assistant created a directory called "bob 1". I didn't expect it to do that, because Apple says home directories can not have a space. But that's what happened and it gave me headaches later because a lot of admin tools won't recognize paths with a space (try it with dscl), even if you use quotes or escape slashes to deal with the space. That's why I wanted to change the home directory name.

     

    Thanks for your help.

    M

  • 11. Re: Guide to change home dir name is wrong!
    chylu Level 1 Level 1 (0 points)

    I don't mean to butt in, but I just experienced the same trouble as macTATAAbox. I have a brand new MBP and used Migration Assistant which created a Home Directory like "Bob 1" rather than my username, "Bob". Very frustrating as none of this would've happened if I hadn't gotten a MBP that had a dead pixel, THEN the display they replaced was faulty which shorted out my WiFi card. But nevermind.

     

    So I followed these instructions to a T and it worked perfectly. I was nervous; like macTATAAbox, I wanted to copy the contents of my Home folder over using Terminal in case something went awry. I couldn't figure out how he did this though, with the space and the 1. Terminal seemed to be telling me my home dir was already called Bob and not Bob 1, so this didn't seem to work. I thought I'd bite the bullet and just follow your instructions, Eric.

     

    Thank you both for sharing this info. I had a very long, late night trying to sort through all this mess. I'm glad Macs are usually time-saving, because I certainly wasted the entirety of yesterday! So glad it's working.

     

    Thank you!