MacOS – To use STDBUF from Homebrew’s coreutils

homebrewmacosterminal

I run brew search stdbuf and get

No formula found for "stdbuf".
Searching pull requests...
Closed pull requests:
coreutils: upstream fix for stdbuf (https://github.com/Homebrew/homebrew/pull/32955)

I run brew install coreutils but get Warning: coreutils-8.23_1 already installed.

I do but see no stdbuf in my system.

$ std [tab]
stdethers  stdhosts   

My PATH is

/usr/local/bin:/usr/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:
/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:/Users/masi/.cabal/bin

Uninstall Macports

Using Macports and Homebrew together cause conflicts.
Final solution is to uninstall Macports which is immature.
Regardless of what your PATH is, Macports causes conflicts with programs in the PATH.
I realised the core of the problem here at the end of the body about How to Enlarge Disk Image in VirtualBox?


How can you use stdbuf in OSX Yosemite?

Best Answer

You have to alter your path adding coreutils dir before /usr/bin. You can do something like this:

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

And should looks like the following after the changes:

/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:/usr/bin:
/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:
/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:
/Users/masi/.cabal/bin

After that, you must be able to use stdbuf.