Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
So did you replace it by writing over /usr/bin/sed? –  slhck Dec 5 '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 5 '12 at 13:56
    
Just out of curiosity, what is the difference what makes you want it back? –  terdon Dec 5 '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 5 '12 at 14:10

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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 5 '12 at 14:09
1  
You must've played around with sudo then. I've uploaded sed from a 10.6.8 installation, but no idea if it'll work for you. –  slhck Dec 5 '12 at 14:12
    
Thanks, worked perfectly! My package installed correctly now. –  Nick Dec 5 '12 at 14:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.