【macOS】The problem of not being able to change the home directory could be solved by restarting


Environment: macOS Sierra 10.12.6

Why is my home directory supposed to be /users/hoge?

Since a new Mac has arrived, I thought about building an environment, but for some reason the home directory (~) is/Users/hoge.

$ ~
-bash: /Users/hoge: No such file or directory


Conclusion: Rebooting Solves

Yes, if you reboot, you will be fine.

$ ~
-bash: /Users/ユーザ名: is a directory

It was.

Supplement 1: Check your home directory

For how to check your home directory, refer to "Change account name and home folder name" here. It seems like home folder = home directory.

If you look at it, it is properly /Users/ username, but in the terminal

$ ~
-bash: /Users/hoge: No such file or directory

...... Riddle. So when I rebooted for the time being, it became /Users/ username instead of/Users/hode.

Supplement 2: Usermod cannot be used

The linux command usermod seems to be easy to change the home directory, but it seems that it can not be used on macOS ... It seems that there is a dscl command instead, but even if I googled it, it only came up with talk of adding accounts, so I ended up solving it by the method of supplement 1.

Author by

Updated on September 22, 2017