How do you mount -bind a local directory? In linux, one of the great things you could do (for developers, in particular) was to mount a folder and locally bind it to another folder on the system.

This had the advantage over symlinks due do the fact tools like Git didn't detect it as being a different type of node, and you didn't need to remove the original contents. When you were done, you could simple unmount and you were left with the original filesystem contents.

However, mount -bind or mount.local don't seem to exist on Mac (as of OS X 10.10.2, Yosemite).

How do you go about this?
As mentioned by another user on StackOverflow, you can use an NFS mount do to this. However, it requires a little bit of one-time setup.

First, you'll need to set up an /etc/exports file (if you haven't done so already).

$ sudo tee -a /etc/exports &lt;&lt;&lt; "/ -alldirs -mapall=$USER localhost"


Secondly, you'll need to start the rpc and nfsd services.

$ sudo launchctl start com.apple.rpcbind
$ sudo nfsd start




From there, give NFSd a little bit to wake up and get breakfast, and you should be good to mount:

$ sudo mount localhost:/path/to/target ./mnt


To restore the original contents, just do

$ sudo umount ./mnt