Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Recover Files from DMG: A Practical Guide

· 5 min read · Home Tech

In this article
  1. What Is a DMG File?
  2. How to Recover Files from a Working DMG
  3. How to Repair a Corrupted DMG
  4. Recovering Deleted Files Inside a Mounted DMG
  5. Common Problems and Misconceptions
  6. How to Choose a Recovery Method
  7. Safety and Precautions
  8. Alternatives to DMG
  9. Frequently Asked Questions

Yes, you can recover files from a DMG file, but the method depends on whether the DMG is a mounted disk image or a corrupted file. This guide explains how to extract files from a working DMG, how to repair a damaged one, and what to do if you accidentally deleted files inside a mounted image.

What Is a DMG File?

A DMG (Apple Disk Image) is a file format used by macOS to distribute software, compress folders, or create encrypted containers. It acts like a virtual hard drive: when you double-click it, macOS mounts it as a volume on your desktop or in Finder, and you can copy files in and out. DMGs can be compressed, read-only (like installer images), or read-write (like a folder you can add files to). They can also be encrypted with a password.

How to Recover Files from a Working DMG

If the DMG opens normally, recovering files is simple:

  1. Double-click the DMG file in Finder. It will mount as a volume.
  2. Open the mounted volume and copy the files you need to your Mac’s hard drive.
  3. Eject the volume by dragging it to the Trash or pressing Command+E.

That’s it. The files are now on your system. If the DMG is an installer, you usually just drag the app to your Applications folder.

How to Repair a Corrupted DMG

If the DMG won’t mount or shows an error like “no mountable file systems,” the file may be corrupted. Try these steps in order:

  1. Use Disk Utility: Open Disk Utility (in /Applications/Utilities), go to File > Open Disk Image, select the DMG, and try to mount it. If it mounts, copy your files immediately.
  2. Run First Aid: If the DMG mounts but is not readable, select the mounted volume in Disk Utility and click First Aid. This checks and repairs the volume’s directory structure.
  3. Use the command line: Open Terminal and run hdiutil verify /path/to/file.dmg to check integrity. If it reports errors, the file is damaged.
  4. Try a different tool: Some third-party disk utilities can recover data from damaged DMGs, but they are not built into macOS. Search for “DMG repair” in the App Store, but be cautious about free tools that may contain adware.

If none of these work, the DMG may be beyond repair, and you’ll need a backup or a data recovery service.

Recovering Deleted Files Inside a Mounted DMG

If you deleted files from a mounted read-write DMG and emptied the Trash, the files are not gone immediately. The data still exists on the disk image until overwritten. To recover them:

  1. Eject the DMG volume.
  2. Use a data recovery app that supports DMG files (like Disk Drill or PhotoRec). These scan the raw image for deleted file signatures.
  3. Alternatively, if you have Time Machine, check if the DMG itself was backed up before you deleted the files. You can restore the entire DMG from the backup.

Important: stop using the DMG immediately after deletion. Writing new data to it can overwrite the deleted files, making recovery impossible.

Common Problems and Misconceptions

  • “DMG is a virus.” DMGs themselves are just containers. However, malicious software can be distributed inside a DMG. Always download DMGs from trusted sources and check the Gatekeeper warning when opening.
  • “I can open a DMG on Windows.” Windows cannot natively mount DMGs. You can use third-party tools like 7-Zip to extract the contents, but they won’t preserve the exact disk image structure. For a full mount, use a tool like TransMac.
  • “Deleting a DMG deletes the files inside.” No. The DMG is a single file. Deleting it removes the whole container, but if you have a backup of the DMG, you can recover the files from that backup.
  • “A corrupted DMG is always recoverable.” Not always. If the header or directory structure is severely damaged, recovery may be impossible without professional help.

How to Choose a Recovery Method

Your choice depends on the situation:

  • DMG mounts but files are missing: Use a data recovery tool on the mounted volume.
  • DMG won’t mount: Try Disk Utility or hdiutil first. If that fails, use a third-party DMG repair tool.
  • You have a backup: Always restore from backup first—it’s faster and safer.
  • The DMG is encrypted: You need the password. Without it, recovery is impossible (unless you know the password hint).

Safety and Precautions

  • Never download a DMG from an untrusted website—it could contain malware.
  • Before attempting recovery, copy the DMG file to another drive so you don’t risk further damage to the original.
  • If the DMG contains sensitive data, use Disk Utility’s “Encrypt” option when creating a new DMG.
  • Always eject a mounted DMG before unplugging an external drive or shutting down to avoid corruption.

Alternatives to DMG

If you frequently need to share folders or back up data, consider these alternatives:

  • ZIP archives: Universally supported, but not mountable as a volume.
  • USB drives: Portable and writable, but less secure than an encrypted DMG.
  • Cloud storage: Easy sharing, but requires internet and may have privacy concerns.
  • APFS snapshots: For local backups, Time Machine uses snapshots that are easy to restore.

Frequently Asked Questions

Can I recover files from a DMG that won’t mount?

Yes, possibly. Try Disk Utility’s First Aid, or use a third-party recovery tool that can read the raw DMG file. If the DMG header is intact, tools like hdiutil can sometimes force-mount it with the -nobrowse option. If not, professional data recovery may be needed.

How do I open a DMG on Windows?

Windows cannot natively mount DMGs. Use 7-Zip to extract the contents (you’ll get files, not a mountable volume), or use a dedicated tool like TransMac to mount it. Be aware that some DMGs are encrypted or have special formatting that these tools may not handle.

What if I forgot the password for an encrypted DMG?

There is no built-in way to recover a forgotten DMG password. The encryption is strong, and without the password, the data is inaccessible. Your only hope is a password hint or a backup of the DMG before it was encrypted.

Is it safe to delete a DMG after mounting it?

Yes, if you’ve copied the files you need. The DMG itself is just a container; deleting it frees up space. But if you delete it before copying, you lose the contents unless you have a backup.

Can I recover files from a DMG after I’ve emptied the Trash?

Yes, if the DMG was mounted and you deleted files from the mounted volume, the data may still be recoverable using data recovery software. Stop using the volume immediately to avoid overwriting. If you deleted the DMG file itself, the same applies—stop using the drive and use recovery software on the underlying drive.