When on OSX, I always install GNU sed version via Homebrew, to avoid problems in scripts, because most scripts were written for GNU sed versions.
brew install gnu-sed --with-default-names
Then your BSD sed will be replaced by GNU sed.
Alternatively, you can install without default-names, but then:
- Change your
PATH
as instructed after installinggnu-sed
- Do check in your scripts to chose between
gsed
orsed
depending on your system