I need to seamlessly mount (and automount, e.g. via fstab) a directory (folder) on one drive to appear at the commandline and GUI level as a directory on another, on the same machine. This is to defeat some "smart" software that detects that symlinks and aliases are not "real" directories and refuses to act on them.
In Linux, this would be trivially easy, with:
mount --bind /path1/source_dir /path2/target_dir
However, Mac OS's version of mount does not support this bind functionality (in any form, including mount -o bind
, or mount -B
), as far as I can determine. It also appears that none of Macports, Homebrew, or Fink supply a ported version of mount with such an option. Some available more specialized mounting tools don't seem to relate, either (e.g. xmount is for disk images, and djmount is for network volumes).
To be clear, I'm not trying to mount a disk or partition as a volume or as a local directory, nor to create a share to be mounted arbitrarily by various users on various machines. Rather, I want to mount a folder, owned and writable only by a particular user, on an HFS+ disk as if it were a folder on another HFS+ disk, locally, in a way that is effectively transparent, with the same permissions and no security/integrity issues.
A sloppy workaround is to create a CIFS share of the folder to be mounted, and (calling a custom, one-shot variant of smb.conf) limit its permissions in Samba just-so, such that it is not public, and has the same permissions as the target location, exactly the right file and directory mask, etc.; then mount it that way. But this would be inefficient, since it would be using the bletcherous Windows filesharing protocol, plus creating a visible share that shows up as a mountable volume from the SMB server, to anyone who can access this machine though SMB/CIFS (even if they cannot actually mount it). The Mac GUI will probably also represent it as a volume being shared.