# macOS: rm: /usr/bin/python: Operation not permitted — even with sudo

**Code:** `rm/mv: Operation not permitted (System Integrity Protection)` · **Category:** macOS · **Seen on:** macOS

System Integrity Protection blocks changes to protected system locations, even for root.

## Meaning

SIP protects `/System`, `/usr` (except `/usr/local`), `/bin`, `/sbin` and Apple apps. The fix is not to disable SIP but to work in allowed places: install tools under `/usr/local`, `/opt/homebrew` or your home folder, and change PATH. For files protected by privacy (Desktop/Documents) the cause is Full Disk Access, not SIP.

## Common causes

- Modifying files under /System, /usr/bin, /bin, /sbin
- Trying to replace system Python/Ruby
- Installer writing to a protected path
- Flag `restricted` on the file (`ls -lO`)
- Confusing SIP with TCC privacy permissions

## Quick fix

1. Install into /usr/local, /opt/homebrew or ~/
2. Put your tool earlier in PATH instead of replacing the system one
3. Check flags: `ls -lO /usr/bin/python3` shows `restricted`

## Detailed fix by platform

### macOS

1. `csrutil status` shows whether SIP is enabled; `ls -lO path` shows the restricted flag

## How to diagnose

1. **Path** — Protected by SIP?
2. **Cause** — SIP or Full Disk Access?
3. **Alternative** — /usr/local?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/macos/sip-operation-not-permitted)
