Written by
Connie YangSummary: This post introduces hdiutil in full scale, including what it does, how to use it to convert DMG to ISO, and what to do if you encounter the hdiutil error message in Terminal.
hdiutil is the command-line tool you need when converting DMG files to ISO on a Mac. In this guide, we'll break down what hdiutil is, how to use it to convert DMG to ISO, and how to fix common problems like 'command not found' and 'attach failed - no such file or directory' when running hdiutil in Terminal.
What is hdiutil, and what does it do
hdiutil is a command-line utility in macOS used for managing disk image files like .dmg, .iso, and .cdr. It allows users to create, mount, convert, compress, and verify disk images.
While it is a built-in tool in macOS, you don't need to download hdiutil. Also, you can't use hdiutil on Windows, Linux, or Ubuntu. You can use the third-party hdiutil alternatives like PowerISO on Windows and dmg2img on Linux and Ubuntu.
How to use hdiutil to convert DMG to ISO
One of the most common uses of hdiutil is converting a DMG file to an ISO. This is especially useful for burning the image to a disc or using it with virtual machines.
Here's how to use hdiutil to convert DMG to ISO:
- Click Launchpad > Other > Terminal.
- Enter the following command to create a file called output.iso.cdr.
Here, you should replace /path/to/desired.dmg with the real path of your .dmg file and /path/to/output.iso with the destination you want the .iso file to be saved to. hdiutil convert /path/to/desired.dmg -format UDTO -o /path/to/output.isoWe recommend you type hdiutil convert and a space first. Then, drag and drop your desired .dmg file to the Terminal window. Type a space, -format UDTO -o, and a space. Finally, drag and drop your desired .dmg file here again and replace .dmg with .iso. This is to save the converted ISO file to the same destination as the DMG file. - Rename the extension of the converted .iso.cdr file to .iso.
Go tell others how to use hdiutil to convert DMG to ISO on a Mac.
How to fix 'hdiutil: command not found'
If you see the error "hdiutil: command not found" when running hdiutil in Terminal, it means your system fails to locate the hdiutil binary. Since hdiutil is built into macOS, this usually indicates a system bug or path misconfiguration.
You can follow these steps to troubleshoot 'hdiutil: command not found':
- Check if your command line is typed correctly. Sometimes, even the absence of a space in the command line will cause this error message.
- Relaunch Terminal and try again.
- Restart your Mac and try again.
How to fix 'hdiutil: attach failed - No such file or directory'
Usually, you will see the "hdiutil: attach failed - No such file or directory" or "hdiutil: convert failed - No such file or directory" error when the file path provided in the command line does not exist or is incorrect.
Here's what you can do:
- Check the file path. Ensure you're using the full and correct path to the file.
- Or, you can drag and drop your file to the Terminal window. After typing hdiutil attach, drag the .dmg file from Finder into the Terminal window to auto-fill the correct path.
- Re-check the entire command line.
If this post helps you comprehensively learn everything about hdiutil on Mac, share it with more people.