Change a file's owner with chown on Mac

Take ownership of files left behind by other users or migrated accounts.

macOSFilespermissionsTerminalMedium risk
Run the command below with your username — you become the owner and can freely rename or delete the file.

01Command

Command
$ sudo chown $(whoami) ~/Documents/oldfile.txt

02What it does

Files copied from another Mac or an old account can carry a previous owner, blocking edits even for admins. chown reassigns ownership; $(whoami) substitutes your short username. Add -R to apply to a whole folder (sudo chown -R $(whoami) ~/folder). Use Finder's Get Info Sharing & Permissions pane for a visual alternative.

03Risk

RiskMedium risk
RequirementsAdministrator password (sudo).
!Warning: Avoid chown on system folders (/System, /usr) — changing ownership there can break macOS.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • chown(8) man page
    Xcode man pages · technical · 2026-09-17
    Evidence: Documents chown ownership syntax and the -R recursive variant.
  • macOS chown command reference
    SS64 · technical · 2026-09-17
    Evidence: chown changes the file owner and group; the owner may be given as user or user:group.

Last verified: 2026-09-19 · Category: Files & Folders

06Related solutions