Grep

GNU grep Releases

⚠️ macOS ships with its own installation of grep.

❗️ DO NOT update or configure the default macOS system grep as this could cause disruptions to normal operations.

grep 3.12 Download

Step 1: Download the latest, stable tarball

Download will be available in $HOME/Downloads directory. Move to appropriate working directory.

Step 2: Extract tarball

tar -xvf grep-3.12.tar.xz && rm grep-3.12.tar.xz
cd grep-3.12

Step 3: Configure and install grep

./configure
make
sudo make install

📝 sudo permissions are required to install in /usr/local/bin.

Step 4: Verify grep install locations

which -a grep
#--- Output ---#

/usr/local/bin/grep
/usr/bin/grep

Step 5: Verify grep active –version

/usr/local/bin/grep --version
#--- Output ---#

grep (GNU grep) 3.12
Copyright (C) 2025 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://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
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

grep -P uses PCRE2 10.45 2025-02-05

📝 Ensure $PATH has /usr/local/bin at a higher priority to leverage the newly installed grep by default.

../