How to delete a folder that has 65535 links on it? Somehow a folder from /var/folders (/var/folders/2j/8_50ggln3wz21k4gmfx86drh0000gn/T/ on my machine) got 65535 links to it. This caused my machine to not boot anymore.
I managed to fix the booting issue my renaming it to something else (mv T X) in recovery mode.

The problem is I can't get rid of it (rm -rf or even ls on it hangs).

ls -tahl ~/.Trash
total 0
drwxr-xr-x+    67 &lt;user&gt;  staff   2.1K Nov 30 00:30 ..
drwxr-x---  65535 &lt;user&gt;  staff   139M Nov 29 22:14 X
drwx------      3 &lt;user&gt;  staff    96B Nov 29 22:01 .


And if I try:

rm -r ~/.Trash/X
...(hanged, does not return)
Wow.  I suggest  trying the following: 

cd ~
sudo find ./.Trash/X -delete


If that stalls out, then try:

cd ~
sudo rm -rf ./.Trash/X/*
sudo rm -f ./.Trash/X/*
sudo rm -rf ./.Trash/X


If that triptych also fails, then I would like to see the output of 

sudo stat -x ./.Trash/X


Hope that this helps,

F.