Skip to content

Instantly share code, notes, and snippets.

@alecthegeek
Last active August 29, 2015 14:27
Show Gist options
  • Save alecthegeek/7ec8c035700b1c580332 to your computer and use it in GitHub Desktop.
Save alecthegeek/7ec8c035700b1c580332 to your computer and use it in GitHub Desktop.
Using Homebrew and prefer GNU utils over OS X BSD programs? Add this to ~/.bashrc
# Use the GNU utils instead of the BSD versions from OS X
# Updates the path if anythings with a gnubin dir changes after
# upgrade
if [[ -n "$(brew --prefix )" ]] ; then
if [[ -e ~/.GNUBINS ]] ; then
GNUBINS=$(cat ~/.GNUBINS)
else
echo "Not Found GNUBINS"
GNUBINS="___NotFoundGNUBINS___"
fi
for i in $(echo $GNUBINS|tr ':' ' ') ; do
if [[ ! -d $i ]] ; then
GNUBINS=$(find $(brew --prefix) -name gnubin|tr '\n' ':')
echo $GNUBINS > ~/.GNUBINS
echo "GNUBINS updated"
break
fi
done
PATH=$GNUBINS:$PATH
echo Using GNU binaries from $GNUBINS by default
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment