RM Undo: How to Recover Files Deleted with RM on Mac

I realized my Mac’s storage was getting low day by day. While cleaning out the junk files, I found that some items could not be removed a moment ago. So I used the RM command to delete them forcefully. These files were successfully deleted, but by mistake, a few other important documents were also removed.

Now, is it possible to revert the RM command, or is there a way to recover deleted files with RM on Mac?

by Nunes Michel

The RM command on a Mac is a great way to delete stubborn files and folders that can’t be deleted normally. However, once you carry it out, the deleted items are permanently deleted and cannot be restored from the Trash. If you have lost important files due to the RM command, don’t worry. Follow this guide to get them back in a few simple steps. Also, you will learn more about the RM command and how to use it safely.

Table of contents
About macOS RM Commands and How to Use Them
Can I Undo the RM Command?
Where Do the RM Command Deleted Files Go?
How to Recover Files Deleted with RM on Mac with Freeware
How to Recover Files After RM via Professional Services
How to Restore Files Deleted by the RM Command from a Backup on Mac
Must-Knows: How to Use RM Command on Mac Safely
Summary
FAQs

About macOS RM Commands and How to Use Them

Function Command Line
Delete a specific file directly rm <Path + FileName>. For example, "rm /User/Name/Desktop/myphoto.jpg"
Delete files of the same type rm <Path + *.Filetype>
Delete hidden files rm -a <Path>
Forcefully delete a file without prompting rm -f <Path + FileName>
Delete a directory rm -r <Path>
Delete only empty directories rmdir <Path>

Tip: You can also combine them, such as "rm -rf <Path>", which will directly delete the entire directory and its contents. Many users have lost important files in this way.

Can I Undo the RM Command?

Unfortunately, there's no way to roll back the RM command to undelete files. There are two reasons:

Are you feeling hopeless after understanding these reasons? While there's no direct way to "rm undo," it's possible to recover permanently deleted files on a Mac using software, even without a backup. Next, we'll explain why and how to do it.

Where Do the RM Command Deleted Files Go?

Just like when you empty the Trash or delete files using the "Shift+Command+Delete" keys, these items disappear immediately.

In this case, the system removes their information from the file allocation table. Although it makes them unavailable for viewing in the Finder or other applications, the file's contents remain on your hard drive until overwritten by new data. This is why Mac recovery software can help find deleted files. Therefore, if you realize that some files have been accidentally removed by using an RM command, use the following methods to retrieve them as soon as possible.

How to Recover Files Deleted with RM on Mac with Freeware

Now, you know there's no such thing as "undo rm" and that deleted files still exist. Without a backup, using data recovery software is your exclusive DIY method for recovering files after an RM command. If you haven't used such a program before, here are two to try.

Option 1: iBeesoft Data Recovery for Mac

It is a very user-friendly and offline data recovery tool that's ready to use right after the installation. Developed with advanced algorithm technologies and frameworks, it not only thoroughly scans every sector of your storage device but also repairs files damaged by overwriting while being deleted. It's ideal for users who've accidentally deleted files using the RM command.

Free File Recovery Software for Mac
★★★★★ (Score 4.8 by 1597 Users)
Supports the recovery of all RM deleted file types on Mac, including documents, photos, videos, audios, and archives, among others.
Recover deleted files on an external disk, Macintosh HD, memory card, USB flash drive, and so on.
Built-in file backup is available for you to use for free, so you don't have to worry about losing important files.

Steps to Recover Files Deleted with RM on Mac

  1. Click the "Download" button to download the macOS Undelete RM application. Find the .dmg file, double-click it, and drag it to the "Applications" folder on the right side of the installation page.
  2. In the first window, you'll see all the storage devices connected to your Mac. Select the one where the RM-deleted files are located, then click the blue "Search for Lost Files" button in the lower right corner of the page. If you only want to recover a specific file type, click "iBeesoft Data Recovery > Settings" in the menu bar to select the file types to scan. It's time-saving.
  3. The software will take several minutes to scan for RM-deleted files. If you discover them during this process, you can pause or stop the scan. Then, double-click it to verify its integrity.
  4. Afterwards, select the files you need and click "Recover" to choose a folder to save them.

That's it! It is the best guide to "undo rm" without a backup. If you're worried about losing these crucial files again due to unexpected incidents, use the backup feature provided by iBeesoft Data Recovery to create a copy for free.

Option 2: PhotoRec

Now that you can use the RM command to delete files, you may already have a basic understanding of command-line tools. In this case, PhotoRec can also help you recover files after the RM command. It analyzes the underlying data regardless of the file system, giving it a higher recovery success rate than other similar types of programs. You can use it by following the steps below.

  1. Open the PhotoRec official website and click "Download" on the left. After clicking "Mac OS X Intel 64-bit" to download it, double-click the archive file to extract all its contents.
  2. Open "Terminal" and enter "sudo &glt;photorec directory>" as shown in the screenshot and press Enter.
  3. Type your Mac login password to launch PhotoRec.
  4. Select the hard drive where the RM deleted files were located > Volume > File System > [Whole] Extract files from whole partition > the directory where the recoverable files are stored.
  5. Finally, click "C" to save files deleted with RM on Mac.

How to Recover Files After RM via Professional Services

Sometimes, recovery software may not be able to help you get those files back, especially when you have saved new data after the RM deletion. In this case, data recovery services like SalvageData, Ontrack, or DriveSavers are another option for recovering permanently deleted files.

They can evaluate the possibility and cost of file recovery for free. If your files are essential and cannot be recovered quickly, consider seeking help from their official website.

How to Restore Files Deleted by the RM Command from a Backup on Mac

Compared to the methods above, this section introduces the most reliable "rm undo" alternative solution. Of course, the prerequisite is that you backed up these files using Time Machine or a cloud service before they were permanently deleted. If that's the case, you can get them back with just a few clicks.

From Time Machine:

  1. Click the Time Machine icon (a clock) in the top menu bar, then select "Browse Time Machine Backups" from the menu. If the files were deleted more than 24 hours ago, you should connect your Time Machine backup drive to your Mac and then select "Open Time Machine."

    Note: If Time Machine isn't in the menu bar, don't worry. You can open it in System Preferences.

  2. Navigate to the directory where you deleted the file and use the arrow on the right to switch the backup time until it reappears.
  3. Select your files and click "Restore" at the bottom of the screen.

From a Cloud Service

Must-Knows: How to Use RM Command on Mac Safely

While it's very easy to remove unwanted files or folders with the RM command line, it's an instant operation, and it doesn't offer any "rm undo" functionality. Therefore, we suggest you always add the "i" command before using any rm command to ensure a confirmation prompt. Besides, you shouldn't use the RM command line to delete files unless you are in one of the following situations:

Summary

In this article, we've mainly introduced various methods for recovering files deleted with RM on a Mac. Among them, the most effective method is to utilize backups. If you don't have the habit of backing up important data yet, please start now.

By understanding more details about the RM delete command, whether there is a so-called "undo rm," and the correct usage method. Even if you continue to use the RM command in the future, we believe this error will not occur again.

Frequently Asked Questions and Answers

iBeesoft only uses cookies to ensure you have the best browsing experience and does not collect any information.