Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save icasimpan/b93297c17c3e81e33021e8f188b079df to your computer and use it in GitHub Desktop.
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
@icasimpan
Copy link
Author

Do not use '--with-default-names'

@jklare
Copy link

jklare commented Jun 15, 2021

If you want to just use sed and not use '--with-default-names', you can add something like "alias sed=gsed" to your .bash_profile or .bashrc or whatever shell you are using.

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