MainspringGuides › chown command
macOS Guide

chown on Mac: Fix File Ownership Problems

Updated July 2026 · 3 min read

macOS records an owner for every file. When that owner isn't you — because the file came from another user account, an old backup, or a drive formatted on a different Mac — you hit "You don't have permission" errors when you try to edit, move, or delete it. The chown command fixes that in one line.

Check who owns the file first

Before changing anything, see what you're dealing with. ls -l prints the owner and group for each file, and whoami tells you your own account's short name:

# show owner and group for a file
ls -l ~/Documents/report.pdf

# show your own username
whoami

In the ls -l output, the third column is the owner and the fourth is the group. On a Mac, your files normally show your short username and the group staff. If the owner column shows a number (like 501 or 502) instead of a name, the file was created by an account that doesn't exist on this Mac — a classic sign of files migrated from another machine.

Write down the current owner before you change it. chown has no built-in undo; the note you take now is your way back.

Take ownership with chown

Changing another account's files requires root, so chown almost always runs under sudo. It takes the new owner (optionally followed by :group) and then the path:

# take ownership of one file
sudo chown $(whoami) ~/Documents/report.pdf

# set owner and group (staff is the default group for regular users)
sudo chown $(whoami):staff ~/Documents/report.pdf

# a folder and everything inside it
sudo chown -R $(whoami):staff ~/Pictures/Imported

# undo: give the file back to the owner you noted earlier
sudo chown previoususer ~/Documents/report.pdf

$(whoami) expands to your username, so these commands work as-is without editing. The -R flag recurses through a folder and everything in it — exactly what you want for an imported photo library, and exactly what you don't want pointed at the wrong path. Never run chown -R against /, /System, or /Library; system files are supposed to be owned by root and various service accounts, and reassigning them can break macOS. Keep it scoped to files that are genuinely yours.

Run ls -l again afterwards to confirm the owner column now shows your username. Permission errors from ownership disappear immediately — no restart needed.

External drives: ignore ownership instead

If the problem is a Mac-formatted external drive full of files owned by someone else's account, there's a cleaner fix than chowning the whole volume. macOS can simply stop enforcing ownership on that drive:

  1. Click the drive on your desktop or in a Finder sidebar, then press Cmd-I (or choose File → Get Info).
  2. Expand the Sharing & Permissions section at the bottom.
  3. Click the padlock and authenticate with your password.
  4. Tick Ignore ownership on this volume.

Every user on every Mac now gets full access to the drive, regardless of who created the files. The checkbox only appears for external volumes — your startup disk always enforces ownership. To reverse it, untick the same box.

Ownership vs. permissions

If ls -l shows you already own the file but you still can't open or run it, ownership isn't the problem — the permission bits are. That's the other half of the Unix access model, handled by a different command: see our guide to fixing file permissions with chmod. Together, chown (who owns it) and chmod (what the owner, group, and everyone else may do) cover nearly every "permission denied" error a Mac can throw.

Prefer switches to syntax?

While you're tuning your Mac, Mainspring turns 90+ hidden macOS settings into labelled, reversible toggles — no flags to memorize, and every change has an off switch.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once