I replaced sed with the GNU version on my Mac. I thought I made a backup of the original (BSD version), but apparently I didn't, and now I need it back. Can someone help me?
Asked
Active
Viewed 548 times
1
-
So did you replace it by writing over `/usr/bin/sed`? – slhck Dec 05 '12 at 13:53
-
Yeah, but in `/usr/local/bin/sed`. I don't think there ever was a `/usr/bin/sed` (at least in OS X) – Nick Dec 05 '12 at 13:56
-
Just out of curiosity, what is the difference what makes you want it back? – terdon Dec 05 '12 at 13:57
-
I'm installing a program using a pkg. This program has known issues with the GNU version of sed and I don't want to try and find every command in its install script(s) to alter it. – Nick Dec 05 '12 at 14:10
1 Answers
2
The "original" BSD sed in OS X is found at /usr/bin/sed.
werner@macleod ~/Desktop% which sed
/usr/bin/sed
The GNU version of sed – at least the one installed with Homebrew – is at /usr/local/bin/sed.
If the GNU version takes precedence over your system sed, you need to change the PATH in your shell so it references /usr/bin before /usr/local/bin. Confirm the existence of both by typing which -a sed.
To restore a binary that came with OS X, you can also use Pacifist and your OS X installation disc – if you have one, that is. Refer to this answer for a step-by-step instruction for Ruby, but sed should be somewhere in there as well.
-
Well, for some reason I do not have `/usr/bin/sed`. Don't know what on earth I did. (Would somebody maybe mind emailing me it?) – Nick Dec 05 '12 at 14:09
-
1You must've played around with `sudo` then. I've [uploaded `sed` from a 10.6.8 installation](http://ge.tt/1dCzqxS/v/0), but no idea if it'll work for you. – slhck Dec 05 '12 at 14:12
-