sed: illegal option -- r
I’m porting a very complicated Subversion repository to git using this helpful migration guide, but because I’m operating on a Mac I hit a minor roadblock. Specifically, I was trying to run this
sed wizardry the migration guide uses for generating
git branches from the Subversion branches, and I got this error:
sed: illegal option — r
The initial web search told me that the issue was that the BSD-style
sed that comes standard in Mac OS X (Snow Leopard, in my case) doesn’t provide the same options as Gnu
sed. One suggestion was using ports or Homebrew to install
gsed instead, but for complicated reasons neither is a valid option for me. (Thumbnail: I uninstalled port to try Homebrew, but my Homebrew installation is broken.)
Then I found this offhand SuperUser comment which solved my problem:
Use -E instead of -r on OS X.
Now you know, aren’t you glad?