Upgrade or install Utility `stat`

I tried to install GNU utility stat

    $ brew install stat
    Error: No formulae found in taps.

However,it succeeded to install GNU Bash

How to achieve such a task?


Solution 1:

stat is part of the coreutils package.

brew install coreutils

This installs stat with a g prefix: gstat.

You can avoid the g prefix by following the Caveats section:

All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc like:

PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"