How do I force eject an external hard drive from Mac terminal?

Answered by Randy McIntyre

To force eject an external hard drive from the Mac terminal, you can follow these steps:

1. Open Terminal: Go to Applications > Utilities > Terminal. Alternatively, you can use Spotlight (Cmd + Space) and search for Terminal.

2. List connected drives: Type the command “diskutil list” in the Terminal window and press Enter. This will display a list of all the connected drives, including the external hard drive you want to eject. Make a note of the identifier (e.g., disk2, disk3) of your external hard drive.

3. Unmount the drive: Type the command “diskutil unmountDisk force /dev/diskX” in the Terminal, replacing “X” with the identifier of your external hard drive. For example, if your external hard drive is disk2, the command would be “diskutil unmountDisk force /dev/disk2”. Press Enter to execute the command.

4. Eject the drive: After unmounting the drive, you can now eject it using the command “diskutil eject /dev/diskX”. Again, replace “X” with the identifier of your external hard drive. For example, if your external hard drive is disk2, the command would be “diskutil eject /dev/disk2”. Press Enter to execute the command.

5. Verify the drive is ejected: You can check if the drive is successfully ejected by using the command “diskutil list” again. If the drive is no longer listed, it means it has been ejected successfully.

It’s important to note that force ejecting a drive can result in data loss or corruption, so it should only be used as a last resort when the drive is unresponsive or causing issues. Before force ejecting, make sure you have saved and closed any files or applications using the drive.

Additionally, if you are unable to force eject the drive using the terminal, you can try other methods such as using the Disk Utility application or restarting your Mac and then ejecting the drive.