Last active
April 28, 2019 13:38
-
-
Save cmsj/be6df09d09a61ab8b1fd8872dd6e1a77 to your computer and use it in GitHub Desktop.
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
#!/bin/echo Don't execute this script directly, source it into your shell. | |
# This script will attempt to make your macOS system behave more like GNU for shell scripts | |
# by diverting as many commands as possible, to the GNU versions, provided by Homebrew | |
# | |
# To use this: | |
# 1) Install various GNU tools via homebrew, such as: | |
# * coreutils | |
# * gnu-getopt | |
# * gnu-sed | |
# * gnu-tar | |
# * gnu-time | |
# * gnu-which | |
# * moreutils | |
# * num-utils | |
# 2) Load this script into your shell when you want to Go GNU: | |
# * source /path/to/homegnu.sh | |
# 3) (optional extra) build something fancy into your $PS1 to detect $__HOMEGNU is set, to let you know commands are different now | |
BREWROOT="/usr/local" | |
GNUPATH="" | |
while read -r gnubin ; do | |
GNUPATH="${gnubin}:${GNUPATH}" | |
done < <(find -L "${BREWROOT}/opt" -type d -name gnubin) | |
export PATH="${GNUPATH}${PATH}" | |
export __HOMEGNU=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment