Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change home directory in OS X Mavericks

After upgrading to OS X Mavericks, when I open terminal I get the following error.

No home directory: /home/(my-user-name)

I can navigate to /Users/(my-user-name) to access my files but I have to do it every time I open terminal. This also affects my projects which access home directory because the path is wrong.

Can anyone tell me how to change the home directory to /Users/(my-user-name)?

like image 950
budding_coder Avatar asked Nov 05 '13 04:11

budding_coder


1 Answers

User records on OS X are stored in a "Open Directory" database. To modify the home directory for a user, you can either

  • open the "Directory Utility" app with

      open "/System/Library/CoreServices/Applications/Directory Utility.app"
      # On older macOS Versions:
      open "/System/Library/CoreServices/Directory Utility.app"
    
  • select the "Directory Editor" tab,

  • choose "Viewing: Users" in the pop-up,

  • select your user,

  • edit the "NFSHomeDirectory" entry,

  • save.

Or, from the command line (as superuser):

# dscl . -change Users/USERNAME NFSHomeDirectory OLDHOMEDIR NEWHOMEDIR

In any case: be careful! A wrong edit in the user Open Directory database might make your system unusable.

like image 92
Martin R Avatar answered Sep 24 '22 22:09

Martin R