Last active
August 29, 2015 14:27
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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