What to do if you notice a message as soon as you launch iTunes, “The iTunes Library file is locked, on a locked disk, or you do not have write permission for this file”. Follow the instructions listed below on how to fix a locked iTunes Library file that prevents iTunes from loading.
Steps to Fix Locked iTunes library.itl file
Step #1 Click Launch Finder by its icon in the dock.
Step #2 Select Music from the list of places of the Finder window then double-click the iTunes folder.
Step #3 Find the iTunes Library file and drag it to your desktop.
Step #4 Launch the iTunes application. It is important to note that your iTunes Library will be empty. Just quit the application by pressing the Command+q keys.
Step #5 Drag the iTunes Library file from the Desktop back to the iTunes folder you original took it from and then click the Replace button to continue.
Step #6 You can now launch iTunes as normal without receiving a locked library message.