macOSMedium

File Locked in macOS: How to Unlock and Resolve the Error

This article explains why macOS locks files and how to fix it. You'll learn how to safely unlock documents through Finder, Terminal, and system settings, as well as prevent the error from recurring.

Updated at February 17, 2026
5-15 minutes
Easy
FixPedia Team
Применимо к:macOS Sonoma 14.xmacOS Ventura 13.xmacOS Monterey 12.xmacOS Big Sur 11.x

What Does the "File is Locked" Error Mean in macOS

The "File is locked" error appears when the macOS operating system cannot grant access to a file for reading, writing, or deletion. The system may lock a file for several reasons: it is open in another application, is being used by a background process (e.g., iCloud or Time Machine), has a "locked" attribute in its metadata, or is restricted by access permissions. Typical symptoms include:

  • In Finder, when attempting to move, rename, or delete a file, the message appears: "The file '...' is locked."
  • An application (e.g., TextEdit, Preview, Photoshop) reports: "The document is unavailable or locked."
  • In Terminal, commands like mv, rm, cp fail with errors Operation not permitted or Resource busy.

The error is not a critical system problem, but it can interfere with everyday work on documents, media files, or projects.

Causes

  1. The file is open in another application — for example, a PDF document is open in Preview and simultaneously in a browser.
  2. A background process is using the file — services like mds (Spotlight), backupd (Time Machine), cloudd (iCloud) can temporarily lock files for indexing or synchronization.
  3. The "locked" attribute is set — in Finder via Get Info (Cmd+I), you can manually check the "Locked" box. This makes the file immutable.
  4. Restricted access permissions — your user account does not have write permissions (only "Read-only"), which often happens with files from other accounts or copied from external media.
  5. Protection from antivirus or third-party utilities — programs like Malwarebytes, Little Snitch, or corporate security systems may lock files for scanning.
  6. FileVault or disk encryption — if a disk is encrypted and not unlocked at the moment of access, its files may be unavailable.
  7. File system corruption — rare cases where errors in disk structure (e.g., on NTFS or exFAT media) lead to incorrect locking.

Solutions

Method 1: Restart the Application and Simple Actions

Often, a file is locked because it is open in the background. Start with the simplest steps:

  1. Close all applications that might have been working with the file (e.g., editors, media players).
  2. If the file is on the Desktop or in the "Documents" folder, restart your Mac — this will guaranteed terminate all processes holding the file.
  3. After restarting, try to delete or modify the file again.

💡 Tip: If the file is on an external drive (USB, SD card), eject the disk using "Safe Eject" and reconnect it.

Method 2: Unlock via Finder

If the "locked" attribute was set manually:

  1. In Finder, locate the problematic file.
  2. Press Cmd+I (or right-click → "Get Info").
  3. In the "Sharing & Permissions" section, check:
    • Ensure your user account (usually "staff" or your name) has "Read & Write" permission. If not, unlock the lock icon at the bottom (admin password required) and change the permissions.
    • Uncheck the "Locked" box (if it is checked).
  4. Close the window and try to perform the action with the file again.

Method 3: Unlock via Terminal (For Advanced Users)

If the file is locked by a process or has a system attribute:

3.1. Remove the "immutable" flag (uchg)

Some files are marked as "immutable" (uchg). To remove the flag:

# Navigate to the folder containing the file
cd /path/to/folder

# Remove the flag
chflags nouchg filename

Example:

chflags nouchg ~/Desktop/document.pdf

3.2. Find and terminate the process holding the file

The lsof utility will show which program is using the file:

lsof | grep filename

Example output:

Preview  1234 user    txt    REG    0,0   12345   123456 /Users/user/Desktop/document.pdf

Here, 1234 is the PID (process ID). Terminate it:

kill -9 1234

After this, the file should become accessible.

3.3. Modify access permissions (if the issue is permissions)

If you lack write permissions:

# Give ownership to the user (replace 'username' with your actual username)
sudo chown username:staff /path/to/file

# Set read & write permissions for the owner
sudo chmod u+rw /path/to/file

⚠️ Important: Use sudo with caution. Do not change permissions for system files (/System, /usr, etc.).

Method 4: Check Antivirus and Security Software

If you have antivirus (Avast, McAfee, Kaspersky) or a firewall (Little Snitch, Radio Silence) installed:

  1. Open the antivirus settings.
  2. Temporarily disable real-time protection or add the folder containing the file to exclusions.
  3. Try to unlock the file again.
  4. If the problem disappears, configure the antivirus so it does not lock necessary file types (e.g., work documents).

Method 5: Check Disk and FileVault

5.1. If the disk is encrypted (FileVault)

  • With FileVault enabled, the disk unlocks only after entering a password at login. Ensure you are logged into an account that can decrypt the disk.
  • Check the status: fdesetup status. If it says FileVault is On, restart your Mac and enter your password at boot.

5.2. Disk error check

If the file is on your main disk and locks frequently without an obvious cause, check the file system:

  1. Restart your Mac and hold Cmd+R to enter Recovery Mode.
  2. Open "Disk Utility".
  3. Select your main disk → "First Aid".
  4. Run the check and repair.

Prevention

To avoid recurring "File is locked" errors:

  1. Do not open the same file in multiple applications simultaneously — especially large media files (videos, RAW photos).
  2. Quit applications properly — don't just hide them (Cmd+H), but fully quit (Cmd+Q).
  3. Disable unnecessary background processes — for example, in iCloud settings, disable "iCloud Drive" for folders you edit offline, or exclude temporary working folders from Time Machine.
  4. Check access permissions when copying files — if you copy files from another Mac or an external drive, immediately verify via Get Info that you have "Read & Write" permissions.
  5. Keep macOS and applications updated — many locking issues are related to bugs in older versions of Finder or file system drivers.
  6. Avoid third-party utilities for "protecting" files — programs that set "locked" or "hidden" attributes can conflict with macOS.

If the problem occurs only with a specific file type (e.g., .dmg, .pkg), this may be a format characteristic — such files are often intended to be read-only.

F.A.Q.

Why does macOS lock files and how does it happen?
Can I unlock a file without using Terminal?
Is the 'File Locked' error related to Gatekeeper?
What to do if a file keeps getting locked?

Hints

Identify which application is locking the file
Unlock the file via Finder
Use Terminal to force unlock
Check antivirus and system protection
Restart your Mac

Did this article help you solve the problem?

FixPedia

Free encyclopedia for fixing errors. Step-by-step guides for Windows, Linux, macOS and more.

© 2026 FixPedia. All materials are available for free.

Made with for the community