Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install gnu sed on Mac OS X and set it as the default
# 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
@asziranyi

This comment has been minimized.

Copy link

@asziranyi asziranyi commented May 24, 2019

Error: invalid option: --with-default-names. (Homebrew/brew#5731)

@matgargano

This comment has been minimized.

Copy link

@matgargano matgargano commented Jun 6, 2019

Error: invalid option: --with-default-names. (Homebrew/brew#5731)

@kristofgiber

This comment has been minimized.

Copy link

@kristofgiber kristofgiber commented Jul 17, 2019

Error: invalid option: --default-names

@bitcoinbrisbane

This comment has been minimized.

Copy link

@bitcoinbrisbane bitcoinbrisbane commented Aug 12, 2019

Error: invalid option: --default-names

+1

@bkalbs-wm

This comment has been minimized.

Copy link

@bkalbs-wm bkalbs-wm commented Nov 13, 2019

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 run brew info gnu-sed and it will tell you what to add to your PATH 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"
@ashishsinghucd

This comment has been minimized.

Copy link

@ashishsinghucd ashishsinghucd commented Mar 24, 2020

Error: invalid option: --default-names
+1

@KelvinFanXian

This comment has been minimized.

Copy link

@KelvinFanXian KelvinFanXian commented Apr 23, 2020

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 run brew info gnu-sed and it will tell you what to add to your PATH 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 ..

@markflarup

This comment has been minimized.

Copy link

@markflarup markflarup commented Jun 23, 2020

Just install gnu-sed without the --with-default-names option. Then run brew info gnu-sed and it will tell you what to add to your PATH to be able to use it as "sed"

+1

@anindita-c

This comment has been minimized.

Copy link

@anindita-c anindita-c commented Nov 11, 2020

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 run brew info gnu-sed and it will tell you what to add to your PATH 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!!

@hui-zheng

This comment has been minimized.

Copy link

@hui-zheng hui-zheng commented Feb 5, 2021

Just install gnu-sed without the --with-default-names option. Then run brew info gnu-sed and it will tell you what to add to your PATH to be able to use it as "sed"

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment