The operation can’t be completed

Fix macOS 'The operation can’t be completed' Error for Good

That cryptic macOS error usually means a file or folder is locked or has a weird permission. Here's how to fix it in under five minutes, plus what to do when it won't go away.

That message — 'The operation can’t be completed because an unexpected error occurred (error code -36)' or just the plain version with no code — drives people nuts. I've seen it on a dozen Macs, from Mojave to Sonoma. It shows up when you're trying to empty the Trash, move a folder to an external drive, or delete that one PDF that refuses to go away. The good news? It's almost always a locked file or a permissions hiccup. Here's the fix.

Quick fix: Unlock the file and clear permissions

Start with the simple stuff. Open Finder and right-click the file or folder that's causing the trouble. Select Get Info (or press Command + I).

  1. Look at the Sharing & Permissions section at the bottom. If it says Read only for your username, click the padlock icon and enter your admin password. Change your access to Read & Write.
  2. Check the General section. If there's a checkbox next to Locked, uncheck it.
  3. Close the window and try the operation again.

After you uncheck Locked, you should see the file's icon lose its little padlock badge. If the action still fails, move to the terminal fix.

Terminal command that actually works

If Finder won't cooperate, open Terminal (find it in Applications > Utilities). Type this, but replace /path/to/file with your actual file path. You can drag the file into the Terminal window after typing chflags nouchg to paste the path automatically.

chflags nouchg /path/to/file

Press Enter. That command removes the uchg flag, which is the Unix-level lock that Finder sometimes ignores. You won't see any output if it works — just a new prompt line. Then try deleting or moving the file again.

If you're dealing with a folder and everything inside it, add the recursive flag:

chflags -R nouchg /path/to/folder

This clears the lock on the folder and every item inside. I've used this on external drives, USB sticks, and files downloaded from sketchy websites. It's the cure for 80% of these errors.

Why this works

The lock flag is stored in the file's metadata, not in the Finder's little checkbox. When you uncheck Locked in Get Info, you're removing the same flag, but Finder sometimes fails to apply it — especially on network drives or files with unusual permissions. The chflags command talks directly to the file system, bypassing Finder's buggy UI.

The error code -36 also pops up when there's a metadata problem on external drives formatted as FAT32 or exFAT. In that case, the file isn't locked — the drive's directory structure is confused. Run chflags nouchg anyway, then try copying the file to your Desktop first, then back to the drive. That reshuffles the metadata and clears the error.

Less common variations

Sometimes the error message includes error code -8083. That one's different — it means the file is in use by another process. Quit all apps, especially Adobe products and Safari, then try again. If it persists, restart your Mac. Sounds basic, but a reboot clears file locks that apps leave behind.

Another variant: error code -36 specifically on photos. That's usually a corrupted thumbnail in the Photos library. Open Photos, find the problematic image, and export it to your Desktop. Then delete the original from the library. The export forces a fresh copy without the corrupted metadata.

If you're seeing this on a Time Machine backup, don't fight it. Time Machine sets its own locks. Instead, use the Time Machine interface to delete old backups, not Finder.

When nothing else works

For truly stubborn files, you can try rm in Terminal. Be careful — this permanently deletes the file, bypassing the Trash.

rm -rf /path/to/file

The -rf flags force deletion and handle folders. There's no confirmation, no second chance. Only use this when you're 100% sure you don't need the file.

I've also seen cases where the file has a weird name with slashes or colons that Finder can't handle. In Terminal, prefix the filename with ./ to tell the system you're pointing to the current directory:

rm ./:odd:name.txt

How to stop this from happening again

Most of these errors come from files downloaded from the internet or copied from Windows machines. When you download a file, macOS adds a quarantine attribute that can confuse Finder. You don't need to remove it for every file, but if you're constantly hitting this error, check your downloads.

For external drives, always eject them properly — don't yank the cable. Use the Eject button in Finder or press Command + E after selecting the drive. Improper ejection corrupts the directory structure and leads to lock-flag weirdness.

Finally, keep your Mac updated. Apple fixed a batch of these Finder bugs in Ventura 13.3 and Sonoma 14.1. If you're on an older version, updating might erase the problem entirely.

That's the whole playbook. Start with Get Info, fall back to chflags, and only touch rm -rf when you're desperate. You'll beat this error every time.

Related Errors in macOS Errors
null macOS 'The operation can’t be completed because the original item for ‘filename’ can’t be found' fix -36 macOS Error -36: Fix Input/Output Errors Fast macOS 'The disk can't be read by this computer' fix com.apple.DiskManagement.disenter-119930068 macOS 'The disk couldn't be mounted' error fix

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.