The coreutils[33] package contains GNU versions of many tools, including sort, stat, cat, date, and many more.
Install coreutils with the following command:
| $ brew install coreutils |
Commands in this package are all prefixed with a g. For example, to use the stat command, you’d use gstat.
To make these commands override their BSD counterparts, modify your .bash_profile file to include the path, and then apply the changes to your current environment:
| $ echo 'export PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"' |
| > >> ~/.bash_profile |
| $ source ~/.bash_profile |
Verify that the changes are applied by using the which comand to verify that the stat command comes from the coreutils package:
| $ which stat |
You’ll see this output:
| /usr/local/opt/coreutils/libexec/gnubin/stat |
Since these files are now at the front of your PATH, they’ll be used first.
18.118.141.27