The OS X kernel prohibits read(2)
operations on directories, so you'll never be able to use user-space tools to read directory entries directly.
If you want to read directory entries from user space, you'll need to open the underlying block device directly, read its superblocks, find the root inode, read the entries to find the next directory in the chain recursively to find the directory you're interested in, and then you can read the directory entries. You will, in essence, write a user-space filesystem driver to do this task.
There was a lot that was clever with the old Unix systems, but this was definitely an awkward part -- the only way to create directories in those days was via the mkdir(1)
command, which was setuid-root, because creating directories had to be done via the mknod(2)
system call. So programs would routinely call system("mkdir /path/to/foo"); chdir("/path/to/foo");
in order to create a new directory.