Item is locked / cannot be deleted (chflags uchg) macOS Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

macOS: The operation can't be completed because the item is locked / rm: Operation not permitted (uchg flag)

A file has the immutable (uchg) flag or is in use, so Finder/rm refuse to delete or change it.

Exact message you may see The operation can't be completed because the item is lockedThe item is locked and can't be deletedrm: Operation not permitted uchgThe operation can’t be completed because the item “x” is in userm: cannot remove: Operation not permitted macOS locked file
Seen on: macOS

Meaning

Clear the flag: chflags nouchg file (recursive: chflags -R nouchg dir), or untick "Locked" in Get Info. If it still fails, check ACLs (ls -le), extended attributes (xattr), whether an app has it open (lsof), and Full Disk Access for Terminal.

Common causes

  • Immutable uchg flag set (locked file)
  • File in use by an app
  • ACL denying delete
  • Protected system area (SIP)
  • Terminal lacks Full Disk Access

⚡ Quick fix

  1. chflags -R nouchg path then delete
  2. lsof path to find users
  3. ls -lO@e path to inspect flags/ACLs/xattrs

Detailed fix by platform

macOS

  1. ls -lO path shows uchg; sudo chflags -R nouchg path

How to diagnose

  1. Flags — uchg set?
  2. Usage — lsof output?
  3. ACL — Present?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

Docker Desktop requires privileged access (vmnetd) — macOS: Docker Desktop needs privileged access / com.docker.vmnetd could not be started (macOS)Docker Desktop requir…Finder error code -36 — macOS: The Finder can't complete the operation because some data in "x" can't be read or written. (Error code -36) (macOS)Finder error code -36Finder error code -43 — macOS: The operation can't be completed because one or more required items can't be found. (Error code -43) (macOS)Finder error code -43Homebrew: Permission denied @ dir_s_mkdir — Homebrew: Error: Permission denied @ dir_s_mkdir - /usr/local/Cellar / /opt/homebrew is not writable (macOS)Homebrew: Permission …Operation not permitted (macOS privacy) — macOS: Operation not permitted — Terminal/app lacks Full Disk Access (TCC privacy protection) (macOS)Operation not permitt…rm/mv: Operation not permitted (System Integrity Protection) — macOS: rm: /usr/bin/python: Operation not permitted — even with sudo (macOS)rm/mv: Operation not …Volume failed to unmount / disk not ejected because in use — macOS: diskutil: Unmount of disk2s1 failed: at least one volume could not be unmounted / The disk wasn't ejected because one or more programs may be using it (macOS)Volume failed to unmo…You don't have write permissions for the /Library/Ruby/Gems directory — macOS: ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory (macOS)You don't have write …Item is l…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.