How do I find which directories are taking up my inode count? I have a problem with my mac frequently having too many files open and programs starting to crash.

Running df -ih on my system reveals that I have used up all the inodes in / (this is after a fresh restart)

Is there an easy way of traversing my system and finding which directories are the culprit? I do have a lot of files, but I want to know which ones I should be focusing on.

A lot of commands I'm finding don't work well on OSX.

Any help will be appreciated.

df -ih
Filesystem      Size   Used  Avail Capacity   iused    ifree %iused  Mounted on
/dev/disk0s2   591Gi  526Gi   64Gi    90% 138068137 16799595   89%   /
devfs          202Ki  202Ki    0Bi   100%       698        0  100%   /dev
map -hosts       0Bi    0Bi    0Bi   100%         0        0  100%   /net
map auto_home    0Bi    0Bi    0Bi   100%         0        0  100%   /home
map -fstab       0Bi    0Bi    0Bi   100%         0        0  100%   /Network/Servers
/dev/disk0s4   303Gi  226Gi   77Gi    75%    321408 80319544    0%   /Volumes/BOOTCAMP
HFS+ does not use i-nodes. New files can be created as long as there is free disk space.

The compatibility layer that emulates the i-node behaviour always reports a percentage of used i-nodes equal to or slightly less than the percentage of used space.