I'm sifting through some incorrect permission issues and discovered the namei command for Linux. Homebrew doesn't currently have a Mac port.

namei - follow a pathname until a terminal point is found

Is there a command or series of commands that can be used to accomplish the same thing on OS X?


You can download the source code for namei from SourceForge. To compile, you need to delete the #include <sys/sysmacros.h> line from stat.c, then run make.

  • 1
    Thanks, I wasn't aware that the version in util-linux was based on the one from SourceForge. I did eventually figure out how to get the util-linux one to compile, but it comes with many other utilities, a lot of which are redundant on OS X. Anyways, see my updated answer for the homebrew formula of the original. Beware, installing from source with make install can cause issues if /usr/local/bin' is ahead of /usr/bin` in your PATH as it installs hardlinked to stat. The formula avoids this and only installs under namei. – Michael D. M. Dryden Apr 15 '16 at 0:12

Macports has a port of it: https://trac.macports.org/browser/trunk/dports/devel/util-linux/Portfile

I did try to make a homebrew recipe for it, but there were some issues getting it to compile. It's definitely possible, but there are some problems to work out.


I've made a formula that can be installed with:

brew install mkdryden/homebrew-misc/namei

This is the original version, not the version pulled into util-linux. (not sure how much has changed since the original)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .