Think about what you were doing before the error appeared. Did you have a photo open from the drive? A video file? A document? Any of those applications can hold a lock on the drive.
Once the success message appears, type exit to close Diskpart.
A simple, open-source tool often more resilient to background locks.
Eject the drive, pull it out, wait 5 seconds, and plug it back in. Alternative: What to do if TransMac Still Fails
This is a common but frustrating issue for users of TransMac (a Windows tool for reading/writing macOS drives). The message indicates that Windows or another process has an exclusive lock on the target drive, preventing TransMac from accessing it. Transmac Drive Has Been Locked By Another Program
Always ensure TransMac is running with elevated privileges. Right-click the TransMac icon and select . If the program was already open, close it and restart it this way. 2. Disable Security Interferance Windows Defender is a frequent culprit for "Locked" errors.
: If you have a File Explorer window open to the USB drive, Windows maintains a handle on the device, locking it from other software. Windows Disk Indexing
When you can't identify the locking program, dedicated file unlocking tools can step in. They work by directly interacting with Windows' file-locking mechanism to force a program to release its hold on a file or drive.
: Hardware switches on some USB drives or software-level read-only attributes can trigger a "locked" status. Step-by-Step Solutions 1. Run as Administrator Think about what you were doing before the error appeared
Before writing a DMG file, right-click the drive inside TransMac and choose Format Disk for Mac . This breaks the Windows file structure cleanly.
Close TransMac completely. Right-click the TransMac icon and select Run as administrator . TransMac needs elevated privileges to override Windows background locks.
If you have access to a working Mac, plug the USB drive in and use Disk Utility to erase it, ensuring the format is MS-DOS (FAT) or ExFAT with a GUID Partition Map . Summary Table: Troubleshooting Steps Run as Admin Grant elevated permissions. Close Explorer Release file-level locks. Diskpart Clean Remove partition locks. Disable AV Stop scanning locks.
Here's a series of troubleshooting steps, starting with the easiest and moving to more advanced techniques. Try these in order. A document
: Services that monitor for new hardware or media files can interfere with the write process. Step-by-Step Resolution Guide 1. Run TransMac as Administrator
You are trying to flash a macOS DMG file to a USB drive on Windows, but TransMac stops you with a frustrating error:
: Open Windows Security > Virus & threat protection > Manage settings and toggle Real-time protection to Off .