Unfortunately Apple has crippled the ln command. You can use the following program to create a hard link to a directory:
#include
#include
int main(int argc, char* argv[]) {
if (argc != 3) {
fprintf(stderr,"Use: hlink \n");
return 1;
}
int ret = link(argv[1],argv[2]);
if (ret != 0)
perror("link");
return ret;
}
Take into account that the hard linked directories may not be in the same parent directory, so you can do this:
$ gcc hlink.c -o hlink
$ mkdir child1
$ mkdir parent
$ ./hlink child1 parent/clone2