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

**Code:** `Item is locked / cannot be deleted (chflags uchg)` · **Category:** macOS · **Seen on:** macOS

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/macos/finder-item-locked-cannot-delete)
