What is the max number of hard links in OS X (10.11)?

Solution 1:

It seems the theoretical limit is about 1 billion hard links on an HFS+ volume.

Indirect node files have a special identifying number called a link reference. The link reference is unique among indirect node files on a given volume. The link reference is not related to catalog node IDs. When a new indirect node file is created, it is assigned a new link reference randomly chosen from the range 100 to 1073741923.

The limit for links to a single file is 4294967295, the maximum number of a UInt32, which is about four times larger than the volume limit, which you'll exhaust first.

linkCount
For indirect node files, this field contains the number of hard links that point at this indirect node file.

As a practical matter, this design is quite strange, and suffers from performance issues. The more hard links you have on a volume, the slower it will be to create a new one, as the system must first find an unused link reference number, then insert it into the metadata directory. Then that metadata directory must be searched to dereference a hard link.

You may begin seeing performance problems with only a few thousand links; your great-grandchildren won't live long enough to create a billion if you start today. In practice you'll notice this most often when managing Time Machine backups, which use hard links extensively.