Idiot deleted /bin/rm. How can it be fixed?

Joined
Mar 29, 2009
Messages
5
Reaction score
0
Points
1
Your Mac's Specs
macbook c2d 2.4, 4gb, 10.5.6
If some idiot was careless enough to, say, delete /bin/rm, how could he put it back in place is OS X?

The silly actions leading to this:

$ sudo /bin/rm file1 otherfile1 otherfile2

Then I thought, "oh there's a file2 as well, easy just copy paste". I copy pasted the '/bin/rm' part as well, ending up with:

$ sudo /bin/rm /bin/rm file2

Thank you,
The idiot
 

vansmith


Retired Staff
Joined
Oct 19, 2008
Messages
19,966
Reaction score
606
Points
113
Location
Queensland
Your Mac's Specs
Too many devices to list
If you use Time Machine, you could always restore rm that way.
 
OP
B
Joined
Mar 29, 2009
Messages
5
Reaction score
0
Points
1
Your Mac's Specs
macbook c2d 2.4, 4gb, 10.5.6
True. Unfortunately, I don't.
Is there any other way?
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
65,246
Reaction score
1,834
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 8, iPhone 11, iPhone 12 Mini, Numerous iPods, Monterey
True. Unfortunately, I don't.
Is there any other way?

Without a backup? Bite the bullet and reinstall. :Grimmace:

Regards.
 

vansmith


Retired Staff
Joined
Oct 19, 2008
Messages
19,966
Reaction score
606
Points
113
Location
Queensland
Your Mac's Specs
Too many devices to list
I don't know if this will work but if you just deleted rm (and no other files), you might be able to copy it from another OS X machine. If you do, I would make sure you get it from a machine that has the same updates installed in case they are different versions (it may have been patched).

In case you use Fink or MacPorts, you should be able to get rm through the coreutils package. This is not a perfect fix but it should at least provide some relief. Someone else here might be able to tell you if you can install it from the OS X disc without reinstalling.
 
Joined
Nov 28, 2007
Messages
25,564
Reaction score
486
Points
83
Location
Blue Mountains NSW Australia
Your Mac's Specs
Silver M1 iMac 512/16/8/8 macOS 11.6
Who knows what has been moved/cleaned/trashed.

Do as chscag suggest and reinstall Leopard after form atting the hard drive.
 

vansmith


Retired Staff
Joined
Oct 19, 2008
Messages
19,966
Reaction score
606
Points
113
Location
Queensland
Your Mac's Specs
Too many devices to list
Who knows what has been moved/cleaned/trashed.

Do as chscag suggest and reinstall Leopard after form atting the hard drive.
I would usually agree but looking at the command executed above, "sudo /bin/rm /bin/rm file2", only rm and 'file2' should have been deleted.
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
65,246
Reaction score
1,834
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 8, iPhone 11, iPhone 12 Mini, Numerous iPods, Monterey
I don't believe you can "just" extract and install rm from the Leopard disk without reinstalling. The file is certainly small enough (46K) but without installing the core of the OS, it appears you can't install it stand alone. I also wonder what else he may have deleted at the same time?

Reinstalling might be overkill, but it's the safe way IMO.

Regards.
 

vansmith


Retired Staff
Joined
Oct 19, 2008
Messages
19,966
Reaction score
606
Points
113
Location
Queensland
Your Mac's Specs
Too many devices to list
You could very well be right but I dont see rm as being integral enough to justify a reinstall. blixa, can you delete files? I wonder if rm is used behind the scenes to remove files (it would be integral in this case).

It appears I am outnumbered and maybe rightfully so. chscag and harryb2448 are more proficient in OS X so take their advice. Might I ask that you try my earlier solution (if you can) just to feed my curiosity? For me, it doesn't seem logical to reinstall simply because you removed one file (that command only deletes the two files rm and "file2" file and nothing more - this I am sure of). What was file2?
 
OP
B
Joined
Mar 29, 2009
Messages
5
Reaction score
0
Points
1
Your Mac's Specs
macbook c2d 2.4, 4gb, 10.5.6
thanks everybody for your kind help.

to answer your questions:
- i can not delete files (rm command not found)
- the only core utility i deleted was indeed rm

i will try vansmith's option (what do i have to lose?), but i'm not sure i know someone with a system like mine. i know three persons with leopard, but all of them have 32bit systems (i have a 2.4 white macbook, which is 64). wouldn't that make a difference?

is there somewhere else from where i can be sure the file would be the right one? does any of you guys have a similar system to mine and would be so kind as to send it to me?

i thought it would be much simpler and that there would be something like debian's apt for os x. :\ (ok, perhaps that's what fink or macports are, i will look into it)

thank you all once again.
 
OP
B
Joined
Mar 29, 2009
Messages
5
Reaction score
0
Points
1
Your Mac's Specs
macbook c2d 2.4, 4gb, 10.5.6
oh, and the other files i deleted where just CSVs from where i had then retrieved all the data i needed.
i will have a look at fink and macports
 
OP
B
Joined
Mar 29, 2009
Messages
5
Reaction score
0
Points
1
Your Mac's Specs
macbook c2d 2.4, 4gb, 10.5.6
copying it from a machine with the exact same specs and updates did the trick. it's been working fine for weeks now. thanks for the help, guys.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top