Mac OS X - How to Symlink /home to /Users
sudo ln -s /Users /home
will work with additional configuration, but I don't think that is a good idea as you should access home via ~
in shell or $HOME
. Also /home
might be a Linux standard and often used in Unix but not always so better to rely on information that is guaranteed to work not something that works only most of the time if everyone has kept to a convention.
To make sudo ln -s /Users /home
work, follow these steps (from the comments):
EDITOR=nano sudo -e /etc/auto_master
# add a "#" at the start of the line beginning with /home
# save changes
sudo automount -cv
sudo ln -s /Users /home
I regret this answer is not exactly authoritative, since I've never actually done this myself--though I have used a similar automounter on other Unix systems--but here's my understanding as to what /home
is used for on OS X.
So, let's follow the trail:
If you first type mount
in Terminal to show active mounts, you'll see this line:
map auto_home on /home (autofs, automounted, nobrowse)
autofs
maps are defined in /etc/auto_master
, and /home
is in turn defined specifically in /etc/auto_home
. If you take a look at /etc/auto_home
, you'll see this line:
+/usr/libexec/od_user_homes
Follow the trail one more step to the od_user_homes
man page, and you'll find a program whose purpose is to take a username, look it up in Open Directory, and return a URL to that user's home directory. If you read up on auto_master
at its man page, you'll find that using an executable program for a map results in that program being called to look up a URL to mount, which is in turn mounted in-place.
The intended application appears to be that, if your Mac is connected to a directory service, going to /home/jdoe
will cause the automounter to mount jdoe
's home directory there.
Based on this, it seems logical to conclude that if you don't intend to connect your Mac to a directory service, you're probably okay removing the /home
auto-mount as detailed in this comment. I don't know how future OS updates will deal with this, though.
There's no use for /home
. OS X, like various other Unix versions, has a unique location for the user. In Linux it's at /home/user
, and in OS X it's at /Users
. This is why it is good practice to use the shorthand "~
" or the environment variable $HOME
.
While you can create a symlink to the user's base/home directory /Users/[username]
using the following command:
ln -s ~ /foo
It will not work to create a link named /home
as there is already a(n unused) directory with that name at the root of the system.
I tried this before and got it working for about a week until I rebooted...
You can't just symlink /home
to /Users
. In fact, you can't even remove /home
.
If you manage to remove /home
, it will reappear after you reboot.
If you move /home
to /home.old
, and symlink /home
, it will remove the symlink /home
.
You can have this working for as long as your mac does not crash or reboot.
When you reboot, it all vanishes!
When you reboot, Mac OS X seems to think that you are creating a new user, so it will overwrite all of your user preferences in your old /Users/username
directory.
Since you copied everything to /home/username
, you expect to see your new home directory when doing ls /home
after you reboot.
Instead, you get NOTHING!!! It is as if it never existed.
In my case, I was freaking out for about 30 minutes, then I booted into single user mode to see if something could be done. I was thinking that I might be able to grab a log file or try to start a repair utility.
In single user mode, my home directory was there. Apple intentionally hides any newly created directories under /home
from the user when in multiuser mode. This is an intentionally evil design feature.
Apple is lame and discourages any and all kinds of hacking their OS. What kind of a design feature is that? Apple hides the contents of the newly created /home
directory. There is absolutely no legitimate reason for Apple to auto-remove the /home
directory...or any user-created directories at all!
In this case, they are mounting a directory over your /home directory...effectively hiding it.
If you are really determined to use /home
instead of /Users
, you might be able to get around it by writing a script to set everything up upon every boot.
Also, I should mention that you should be able to use some other directory that is not /home
as a replacement for /Users
because only /home
is banned.
If you use bash, then you will have to set some of the environment variables... namely: CD_HOME
and HOME
.
I wish to add that...although you cannot unmount or force unmount /home
, you can mount a disk on top of /home
. All of this mounted on top of "auto_home".
I was able to mount the recovery disk on top of /home
successfully...perhaps this is how it can be done.