-
-
Save andre3k1/e3a1a7133fded5de5a9ee99c87c6fa0d to your computer and use it in GitHub Desktop.
# Check which version of sed is used when you run the `sed` command | |
# The version that ships with Mac OS X is | |
# /usr/bin/sed | |
which sed | |
# Install gnu-sed using Homebrew | |
# The `--with-default-names` option configures `sed` to use gnu-sed | |
# Without that option, you'll need to type `gsed` to use gnu-sed | |
brew install --default-names gnu-sed | |
# Verify which version of sed is used when you run the `sed` command | |
# OK: /usr/local/bin/sed | |
# BAD: /usr/local/bin/gsed | |
# If BAD, run `brew uninstall gnu-sed`, then reinstall with `--with-default-names` | |
which sed |
Error: invalid option: --default-names
+1
As others have pointed out,
--with-default-names
has been deprecated Homebrew/brew#5731.Just install gnu-sed without the
--with-default-names
option. Then runbrew info gnu-sed
and it will tell you what to add to yourPATH
to be able to use it as "sed"brew info gnu-sed (snippet) ==> Caveats GNU "sed" has been installed as "gsed". If you need to use it as "sed", you can add a "gnubin" directory to your PATH from your bashrc like: PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
thanks!
brew info ..
Just install gnu-sed without the
--with-default-names
option. Then runbrew info gnu-sed
and it will tell you what to add to yourPATH
to be able to use it as "sed"
+1
As others have pointed out,
--with-default-names
has been deprecated Homebrew/brew#5731.Just install gnu-sed without the
--with-default-names
option. Then runbrew info gnu-sed
and it will tell you what to add to yourPATH
to be able to use it as "sed"brew info gnu-sed (snippet) ==> Caveats GNU "sed" has been installed as "gsed". If you need to use it as "sed", you can add a "gnubin" directory to your PATH from your bashrc like: PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
Thanks!!
Just install gnu-sed without the
--with-default-names
option. Then runbrew info gnu-sed
and it will tell you what to add to yourPATH
to be able to use it as "sed"
thank you!
As others have pointed out,
--with-default-names
has been deprecated Homebrew/brew#5731.Just install gnu-sed without the
--with-default-names
option. Then runbrew info gnu-sed
and it will tell you what to add to yourPATH
to be able to use it as "sed"brew info gnu-sed (snippet) ==> Caveats GNU "sed" has been installed as "gsed". If you need to use it as "sed", you can add a "gnubin" directory to your PATH from your bashrc like: PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
THANK YOU!!
For zsh
, after installing gnu-sed
using brew install gnu-sed
, I just added this at the end of the ~/.zshrc
:
export PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"
You path may vary and you can acquire it using brew info gnu-sed
(as mentioned above). The key is to add it late in the ~/.zshrc
. Also note, that if you are using a different shell, you will want to change the path variable in the corresponding configuration file.
As others have pointed out,
--with-default-names
has been deprecated Homebrew/brew#5731.Just install gnu-sed without the
--with-default-names
option. Then runbrew info gnu-sed
and it will tell you what to add to yourPATH
to be able to use it as "sed"