Skip to content

Instantly share code, notes, and snippets.

@huqi
Created May 6, 2015 09:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huqi/2ecd24fd3c32c3f4cc57 to your computer and use it in GitHub Desktop.
Save huqi/2ecd24fd3c32c3f4cc57 to your computer and use it in GitHub Desktop.
Mac gnu grep
# Enable dupe and install
brew tap homebrew/dupes
brew install homebrew/dupes/grep
# Install the perl compatible regular expression library
brew install pcre
# Add the symlink to a place in $PATH
ln -s /usr/local/Cellar/grep/2.14/bin/ggrep /usr/bin/ggrep
# Add an alias
alias grep="ggrep"
# Verify you got it!
$ grep --version
grep (GNU grep) 2.14
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
# If you want it to be permanent, you can add the alias line to your ~/.bash_profile
# You probably want the alias to stick after reboots
echo 'alias grep="ggrep"' >> ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment