Home > How to Tips

'An unexpected error occurred (error code -8072)' on Mac [Fixed]

Updated on Monday, November 18, 2024

Written by

Jenny Zeng

Approved by

Jessica Shee

English

Summary: This article explains what macOS error code 8072 is and different ways to fix it, no matter whether it pops up when deleting files, emptying the Trash, copying or moving files, renaming files, etc.

If you're a long-time Mac user, you probably have witnessed various error codes regarding the message "The operation can't be completed." Error code 8072 is one of them, which can be triggered by various scenarios including emptying Trash. The error only states that "An unexpected error occurred," which does not help resolve the issue.

In this article, we'll explore what macOS error code 8072 is, its causes, and the ways to fix it.

What is Mac error code 8072?

Mac error code 8072 is an error that occurs when deleting files from internal or external drives on Mac, emptying the Trash, renaming files, creating new folders on the desktop, dragging and dropping files to the desktop, converting images, copying files between your Mac and an external drive, etc.

Its full message either reads "The operation can't be completed because an unexpected error occurred (error code -8072)" or "The operation can't be completed. An unexpected error occurred (error code -8072)." Several reasons may cause error code 8072 to occur on Mac, such as:

Temporary glitches: If your Mac is having minor glitches at the moment you interact with a file, it may result in error code 8072.

Insufficient permissions: If you don't have the appropriate permissions to perform the desired action on the files, you might encounter this error code.

Corrupt files: If the files you are trying to delete, move or copy are corrupted, the error code can occur.

File in use or not on your Mac: If the files you are trying to delete, move or copy are currently in use by another application or on a server, you might receive this error code.

Share the information about error code 8072 on Mac with more people!

 

How to fix Mac error code 8072?

In the following paragraphs, we will discuss different ways to resolve macOS error code 8072. As the error can occur during different actions, we have included solutions to each of these cases. Consequently, some solutions may be more helpful to others than you. Still, it's recommended to read along and follow those applicable to your case.

Boot into Safe Mode

When your Mac is experiencing errors like error code 8072, it's a good idea to troubleshoot it in Safe Mode, which can isolate third-party software, clean system caches, and check your startup disk for errors. You can boot into Safe Mode and repeat what you were trying to do. If it still doesn't work, restart your Mac normally and try the following solutions.

 Tips: If you're working with files on an external drive, try safely ejecting it and repeating your intended action after reconnecting it.

Change the permission of the file or folder

The second thing you should do when getting macOS error code 8072 is to check if your account has write access to the file or folder you want to delete, copy, create, or rename. If you don't have sufficient permission, make sure you adjust the permission settings.

  1. Right-click the file or folder that gives you error code 8072 and select "Get Info."
  2. Ensure the checkbox next to Locked isn't ticked.
  3. Under "Sharing & Permissions," check if your account has Read & Write privileges.
  4. If it doesn't, tap the yellow padlock and enter your password.
  5. Then change the permission to Read & Write.

Now, you can retry what you failed to do to see if it works. If the issue persists, continue with the other solutions below.

Disable SIP

Certain folders and files on Mac are protected by SIP (System Integrity Protection) from being modified or tampered with, even by users with administrative privileges. When you attempt to delete them, you will encounter error code 8072 on Mac. To fix the error, you can disable SIP in Recovery Mode and then reenable it after deleting the files.

  1. Boot into macOS Recovery.
  2. Go to Utilities > Terminal.
  3. Type the command below and hit the Enter key.csrutil disable
  4. Restart your Mac and retry modifying files.
  5. Reenable SIP in Recovery Mode.

Nevertheless, I suggest you look into these files on the internet before deleting them, as deleting some may cause issues.

For instance, the .MobileBackups.trash folder, which is a temporary folder that contains deleted items from local snapshots created by Time Machine when the backup disk isn't available, is protected by SIP to ensure the integrity and security of your system.

Its files are automatically removed when the local snapshots are deleted. So, it's generally not recommended to manually delete them, although you can after disabling SIP. Instead, you should delete the local snapshots.

Delete, copy, and move files with iBoysoft MagicMenu

If the error "The operation can't be completed because an unexpected error occurred (error code -8072)" occurs when you are attempting to delete, copy, or move files on Mac, try iBoysoft MagicMenu. It's a Finder contextual menu extension that enables you to right-click on selected files and quickly copy or move them to a preferred path or delete them directly.

This multifunctional tool also grants you access to create a new file, fully uninstall apps, zip files, capture screens, remove duplicate files/photos, hide files, convert images, and many more by a simple right-click.

Here's how to use it to permanently delete, copy and move files on Mac:

Step 1: Download and install iBoysoft MagicMenu.

Step 2: Select a file, right-click on it, and choose the appropriate action.

Delete files with iBoysoft DiskGeeker

If you are still stuck with error code 8072 when deleting files or emptying the trash on Mac, there's an easier way to do it in iBoysoft DiskGeeker. It's a versatile and easy-to-use disk management tool that allows you to permanently delete unwanted files on your Mac, freeing up disk space and improving your Mac's performance.

It can scan your hard drive and present the files in an easily navigational way, allowing you to delete files that won't delete otherwise. Since it also lists files in your Trash, you can use it to empty your Trash as well. Additionally, you can clean large files by sorting them by size and get rid of temporary files, log files, and other unnecessary data accumulated over time.

Here's how to delete files with iBoysoft DiskGeeker:

Step 1: Download and install iBoysoft DiskGeeker for free.

Step 2: Launch the software, select a volume of your disk, and click "Clean Drive."

Step 3: Wait for the scan to complete.

Step 4: Navigate to the files you can't delete because of error code 8072, tick the boxes next to them, and click "Delete All."

Step 5: If you want to delete other unwanted large files on Mac, click Size to sort them, then repeat step 4.

Step 6: Click Cancel and return to the main interface. Then select an internal volume and click "Clean Junk."

Step 7: Check the boxes next to files in your Trash or other unnecessary junk files and click "Delete All."

Use Terminal

On the other hand, if Mac error code 8072 is preventing you from deleting files, emptying the Trash, or performing other actions you desired, you can use the built-in Terminal app to complete these tasks. It's the command-line interface of your operating system, which is often a more powerful alternative than the graphical interface you're interacting with all the time.

You can take the following steps to use Terminal to avoid macOS error code 8072:

  1. Open Finder and launch Terminal from the Applications/Utilities folder.
  2. Choose the appropriate command from the below and ensure you follow the instructions to execute it. Note that you need to press Enter to run a command and you shouldn't leave a space at the end of the command.
  3. To delete files permanently on Mac:rm -rf file_pathFirst, type rm -rf in the Terminal window and hit the Space bar once. Then select the file(s) or folder(s) you can't delete due to error code 8072 and drag and drop them into Terminal to get the path(es). Last, hit the Enter key to execute the command.
  4. To empty the trash, type in the following command and hit Enter:sudo rm -rf ~/.Trash/*Enter your administrator's password and press the Enter key when asked. Note that the password won't be echoed to the screen.
  5. To rename a file:mv file_path file_path_with_new_nameType mv into Terminal, leave a space, drag and drop the file you want to rename into Terminal, then type in the full path you'd like to save the renamed file. For example, the picture below renames the photo IMG_0179 to TestImage and saves it to the same location.

  6. To create a new folder:cd directory_you_want_to_create_the_new_foldermkdir new_folder_nameIf you want to create a new folder on the desktop, you need to execute cd desktop in Terminal, then run mkdir Test\ Folder to create a new folder named Test Folder.
  7. To copy files from one location to another:cp file_path destination_pathType cp in Terminal, leave a space, drag and drop the file you want to copy into Terminal, then drag and drop the folder, external drive, or where you want to copy the file to into Terminal and press the Enter key.  
     

Share this post if you find it helpful!

 

Repair your drive with First Aid

Checking and repairing your internal hard drive with Disk Utility is also helpful if the error is caused by corruption on your disk. If the files are on your external disk, scan it as well.

  1. Open Finder, then launch Disk Utility from the Applications/Utilities folder.
  2. Select your drive from the left side and click "First Aid."
  3. Click Run.

Then wait while Disk Utility is checking your drive. If it finds errors, it will automatically repair them if possible. Suppose it detects errors on your startup disk, you need to enter macOS Recovery to fix them.

Delete Time Machine backups from Terminal

Usually, your Time Machine backup disk will automatically delete old backups when it runs out of storage. However, you may want to manually delete Time Machine backups when getting errors like "Time Machine could not backup to the external drive."

If you can't delete these backups and experience Mac error code 8072, try doing it in Terminal. Ensure Terminal has full disk access and follow the steps below:

  1. Keep your Time Machine backup disk connected and open the Terminal app.
  2. Type the following command and hit Enter to list all backups on your backup disk.tmutil listbackups
  3. Run the following command to delete unwanted backups.sudo tmutil delete folder_pathType sudo tmutil delete, leave a space, then drag and drop the Time Machine backup folder you want to delete into Terminal and press Enter.
  4. Type your administrator password and press the Enter key. (You won't see the passwords when typing.)

If you still can't get rid of the Time Machine backups, consider erasing the Time Machine backup disk to delete all backups and set up Time Machine again.

Create a duplicate file and then rename it

"An unexpected error occurred (error code 8072)" may occur when renaming files on Mac. In this case, you can bypass the error by duplicating the file you wish to rename, then renaming the duplicate.

Drag and drop files instead of copying and pasting

If you are trying to copy and paste files on Mac when receiving "An unexpected error occurred (error code 8072)," try dragging and dropping these files instead. This way, it won't involve the system clipboard, which may be having issues processing the task.

Create a desktop folder in private/var/root

If you have logged in as the root user, you may notice your desktop is empty and encounter the error "An unexpected error occurred (error code 8072)" when trying to create a new folder on your desktop or drag and drop or save files to your desktop or the Documents folder.

That's likely because your Desktop or Documents folder is missing. To verify if it's the issue, you can navigate to the location where the folders of the root user reside with the following steps:

  1. Open Finder.
  2. Click Go > Go to Folder from the menu bar.
  3. Type "private/var" and press the Enter key.
  4. Locate the root folder, which should have a forbidden sign at the lower-right of its folder icon.
  5. Right-click on the Root folder and select "Get Info."
  6. Tap the yellow padlock and enter your password.
  7. Allow your account or everyone to have Read & Write access. (If the above steps don't allow you to access the root folder, try disabling SIP in Recovery Mode. Remember to reenable SIP after the problem is fixed.)
  8. Open the root folder to see if it has a Desktop folder.

If it doesn't have the Desktop folder, you can create one yourself. After that, you should be able to work with your desktop without running into macOS error code 8072.

Also read:

The Operation Can't Be Completed (Error Code -8062) | Fixes

Mac Error Code -924: What It Is And How to Fix It?

Mac Error Code -100092: What Is It And How to Fix It?

Have you resolved error code -8072 on Mac? If the answer is yes, please share this post to help more Mac users.