Fix iTunes Library.itl File Is Locked Error
In this article
The "iTunes Library.itl file is locked" error usually appears because the file's permissions are set to read-only, or because another program (like a syncing tool or a second iTunes window) is holding it. The fix is to unlock the file and give your user account full read/write access, then restart iTunes. Below are the exact steps for Windows and macOS.
What You'll Need
- Access to the computer where iTunes is installed
- Administrator or owner account on that computer (to change file permissions)
- iTunes closed completely (check the Task Manager or Activity Monitor)
Step-by-Step
- Close iTunes completely. On Windows, right-click the iTunes icon in the system tray and choose "Quit". On macOS, press Cmd+Q. To be sure it's not running in the background, open Task Manager (Ctrl+Shift+Esc) on Windows and end any iTunes or AppleMobileDeviceService processes. On macOS, open Activity Monitor and look for "iTunes" or "Music" (depending on your version) and force quit if needed.
- Locate the iTunes Library.itl file. The default locations are:
- Windows:
C:\Users\[YourUsername]\Music\iTunes\iTunes Library.itl - macOS:
/Users/[YourUsername]/Music/iTunes/iTunes Library.itl(in older macOS versions) or~/Music/iTunes/Music Library.itl(in newer versions with the Music app)
- Windows:
- Right-click the file and select "Properties" (Windows) or "Get Info" (macOS).
- Unlock the file.
- Windows: In the Properties window, at the bottom, if there is a checkmark next to "Read-only", uncheck it. Click Apply, then OK.
- macOS: In the Get Info window, if there is a lock icon in the bottom right corner, click it and enter your administrator password to unlock. Then, next to "Sharing & Permissions", click the arrow to expand. If the "Read only" or "No access" is set for your user, change it to "Read & Write".
- Change file permissions if needed.
- Windows: In the Properties window, go to the "Security" tab. Click "Edit...". Click Apply, then OK. If you get a permission error, you may need to take ownership first: click "Advanced", then "Change" next to "Owner", type your username, and click OK.
- macOS: In the Get Info window, under "Sharing & Permissions", click the lock icon to unlock, then click the plus (+) button to add your user if not listed. Set the privilege to "Read & Write". Make sure the gear icon at the bottom is set to "Apply to enclosed items" if you also have other files in the folder that might be locked.
- Rename the .itl file (optional but recommended). If the file is still locked or corrupted, rename it to something like "iTunes Library (locked).itl" or "iTunes Library - Backup.itl". This forces iTunes to create a new library file. Your music files and playlists are stored in the Media folder, so you won't lose your actual music, but you may lose playlists and play counts.
- Restart iTunes. Double-click the iTunes icon (or open the Music app on macOS Catalina or later). If you renamed the file, iTunes will create a fresh library. If you didn't rename it, iTunes should now be able to read the unlocked file.
Common Mistakes
- Not closing iTunes completely: If iTunes is running in the background, it will re-lock the file. Always check the system tray (Windows) or Dock (macOS) and force quit if necessary.
- Only changing the read-only attribute, not the permissions: On Windows, unchecking "Read-only" may not be enough if the Security tab still restricts your user. You must also grant "Modify" or "Full control" to your account.
- Editing the wrong file: Make sure you're changing the .itl file, not the .xml file (iTunes Library.xml) or the folder itself. The .itl file is the one that stores your library database.
- Not taking ownership on Windows: If you get "Access Denied" when trying to change permissions, you need to take ownership of the file first via the Advanced Security settings.
Tips
- Back up your library first: Before making any changes, copy the entire iTunes folder to an external drive. That way, if something goes wrong, you can restore it.
- Use the "iTunes Library.itl" file in its original location: If you moved it, iTunes may not find it. Keep it in the default Music/iTunes folder.
- After renaming, re-import your media: If you let iTunes create a new library, you'll need to re-add your music files by going to File > Add Folder to Library (Windows) or File > Add to Library (macOS).
- Check for third-party syncing tools: Programs like iMazing or CopyTrans can sometimes lock the file. Close them before starting iTunes.
Troubleshooting
If the error persists after following the steps above, try these in order:
- Restart your computer. This releases any file handles that might be held by other processes.
- Run iTunes as administrator (Windows only). Right-click the iTunes icon and select "Run as administrator". This gives iTunes elevated permissions to access the file.
- Delete the .itl file entirely (not just rename). This is a last resort because it will remove your playlists, play counts, and ratings. Your music files remain safe in the Media folder. After deleting, iTunes will create a brand new library file.
- Check for disk errors. On Windows, run
chkdskon the drive where the iTunes folder is located (open Command Prompt as administrator and typechkdsk C: /f). On macOS, run First Aid in Disk Utility. - Reinstall iTunes. Uninstall iTunes (and related Apple software like Apple Software Update) and reinstall the latest version from Apple's website or the Microsoft Store. On macOS, you can't easily reinstall the Music app, but you can update macOS.
Frequently Asked Questions
Will I lose my music if I rename or delete the .itl file?
No. Your actual music files are stored in the iTunes Media folder (usually inside the iTunes folder). The .itl file only contains your library database (playlists, play counts, ratings). Renaming or deleting it will not delete your music files, but you will lose playlists and other metadata.
Why does the .itl file get locked in the first place?
It usually happens when the file is marked as read-only (often after copying from another computer or a backup), or when another program (like a cloud sync service or a second iTunes instance) is using it. It can also occur if the file is corrupted after a crash.
Can I fix this on a Mac with the Music app (macOS Catalina or later)?
Yes. The steps are the same, but the file is called "Music Library.itl" or "iTunes Library.itl" depending on your macOS version. The location is still ~/Music/Music or ~/Music/iTunes. Use "Get Info" to unlock and set permissions.
Do I need to change permissions for all users or just my account?
Just your account is enough. The error is about your user not having write access. However, if you're the only user, setting it for your account is sufficient.
What if I don't have an administrator password on this computer?
You'll need to get the administrator password from the person who set up the computer. Without it, you cannot change file permissions or take ownership on Windows, or unlock the file on macOS.
Is it safe to delete the .itl file and let iTunes rebuild it?
Yes, it's safe for your music files, but you will lose playlists, play counts, and any custom library settings. If you have a backup of the .itl file, you can restore it later. Otherwise, be prepared to rebuild your playlists.