Having a virtual machine running macOS opens up a lot of opportunities for learning. If you are into security, you can set up a VM for your security lab. Or if you want to learn networking or kernel debugging, it is also helpful to use a VM. The other option is risk breaking your work machine in your experiments (not fun). To build our VM, we need to use Disk Images, another topic that is useful in other areas.
Both topics are interesting, and we can combine them. In this post, I'll show you the basics of working with Disk Images and also as an example we are going to create an ISO image to build our macOS Catalina VM using VirtualBox.
Choose the source DMG file you want to convert. Set the output file format to iso file. Enter the output file path name. Click 'OK' button to start converting dmg file to iso. Step 1: Once you have the macOS install DMG file on a Windows PC, click on Windows + R to open the run dialog box, and type in CMD, then hit Enter. When the Command Prompt opens up, use the following command to convert the file to ISO: hdiutil convert /path/sourceimagefile.dmg -format UDTO -o /path/targetmage.iso. Download Mac Os X 10.10 Dmg Installesd.dmg To Iso Linux Abrir Arquivo Dmg No Windows 7 Convert Iso To Dmg Windows 10 Why Can't I Install Javaforosx.dmg On My Macbook 5 Dmg To Wpn Enchanting Convert Yosemite App To Dmg Mac Os 10.6 Dmg Full Version Can I Delete Dmg Files Once Installed Download Os Mountain Lion Dmg. Since ISO is a better format for Windows, you can also convert the DMG to the ISO format and then use the ISO disk image to create the bootable USB. Please note that you can't boot your Mac from bootable USB made from an ISO file, which means you'll have to convert it back to DMG prior to that. How to prepare a bootable usb disk from 'InstallESD.dmg'? I have High Sierra correctly installed on my Mac. I need to clean install 'el capitan' on a old mac book pro (late 2011). I have 'el capitan' 'InstallESD.dmg' file. How to prepare a bootable usb disk? I've tried the 'restore' function in disk utility, selecting 'InstallESD.dmg' as source.
There's a lot of information so let's get started.
NOTE: We need to download the macOS Catalina installer from the AppStore, it's around 9Gb, so It'll take some time to download. Better start now while we learn about Disk Images.
Table of Contents
We'll learn by making, so let's start by creating a folder that we'll use as the base for our image.
Let's add some content to our folder:
Ok, this is going to be our simple image structure:
We are going to use
hdiutil. This tool uses the
DiskImages.framework for... well, manage disk images. Or at least that is what its man page says. But I couldn't find any documentation on the
DiskImages.framework so I assume it's a private framework. If you know anything about it, let me know. In the meantime, I encourage you to read the man page hdiutil(1) for more information.
Alright, that should have created
miapplicacion.dmg image in your desktop. We can now delete the
~/Desktop/myapp, we don't need it anymore.
We can now mount the image. We can do that by clicking it using the Finder, or by using
hdiutil again. I'll use
hdiutil so we get more comfortable using it.
That will mount our image in
/Volumes/myapp. I purposefully gave different names to the dmg and the image so you can see which one will be used when mounted.
If you check the newly mounted image, you'll see our
hello.txt with the content
Now you can eject it from the Finder or use
hdiutil again. As you probably imagined, I'll show you how to do it with
You can use the name of the volume or the device, in my case:
We create the image using a source folder. We could also have created an empty image and then add content to it. Let's see how to do that.
That create s new image of ten megabytes of space. To work with that image, we need to mount it. We are going to mount it but without including its filesystem.
DANGER, WILL ROBINSON! PLEASE MAKE SURE YOU ARE POINTING TO THE CORRECT DEVICE, ELSE YOU CAN LOSE DATA! I WON'T BE RESPONSIBLE FOR ANYTHING YOU DO WITH THE INSTRUCTIONS I POST HERE, TREAD CAREFULLY.
In my computer the image is mounted in
/dev/disk3 it might use a different one on your computer so make sure you refer to the correct one or BAD THINGS WILL HAPPEN.
Why did we mount our image this way? Well, we did it so we can format the volume using
diskutil. Let's do that.
Now we can add some content to that Image.
Now we can eject the volume.
And now you can mount it again, and you'll see your
howdy.txt file. The images we've created are Read/Write. We can also convert it to a read-only image:
You can see all the supported formats in the man page. Here is the list in mine:
Now if we mount our new image and try to write to it we'll get an error:
Alright, that should give us enough background on Disk Images (
.dmg) to build our ISO image for Catalina. Let's do that now.
Since Mac OS X Lion (10.7 - released in 2011), Apple decided to no longer distribute an installation DVD, it provides the installer as an application that can be downloaded via the AppStore. This installer application contains the base system for installation and also a
Recovery image that includes a basic OS implementation that is used at boot time. When you boot to the
Recovery volume, you can use it to restore and/or install the operating system. You can read more on This detailed article on AFP548.
The idea is to extract all the parts from the
Install macOS Catalina.app application bundle to build our ISO. I'm going to use Jeff Geerling's macOS VirtualBox VM script as a basis. It is similar to the instructions in Kedy Liu's article on macOS Kernel Debugging.
We are going to mainly focus on the
BaseSystem.dmg images that come inside the application installer to generate an ISO image.
If you are not familiar with the ISO format, an ISO image is the image format used on an optical disk. It is the format used by DVD, CD, or Blue-ray Disc. In the past, it was common to use CDs as the media to install the operating systems. VirtualBox supports that format. We plan to create an ISO image from the installer.
After the AppStore download is complete, you'll be able to find the
Install macOS Catalina.app inside your
I'll be using macOS Catalina as an example, but as long as you have the installer of any OS newer than 10.7, the process should be similar.
Navigate to the
/Applications/Install macOS Catalina.app/Contents/SharedSupport/ directory, and list the files:
Convert Installed Dmg To Iso Online
Excellent, we have the
BaseSystem.dmg and the
InstallESD.dmg. Inside the
InstallESD.dmg we'll find the installer that uses the
BaseSystem image to install the OS.
To extract the installer we'll need to mount the
BaseSystem.dmg has an image formatted in
HFS. We can create an empty image as we did in the last example of the previous section. Then we can 'restore' the
BaseSystem image in the newly created image. It sounds confusing, but you'll understand it better when we begin doing it.
Let's begin by creating the destination image. I'll show you the command first and after I'll explain what it does.
We are creating a sparse image. The sparse image type means that the image we create will only take as much space as the content we put on it, with the limit of 9 Gigabytes that we set. The layout indicates the partition table's layout for the created volume. We are stating that we want a single entry. The partition table layout can be split in multiple
/dev entries. For example, we could have one for the GUID Partition Table (GPT), and the other partitions have the data. With the
SPUD layout, we will only have one
/dev entry. If you want to learn more visit the following links about Apple partition Map and GUID Partition Table.
We also define the file system type to be
BaseSystem.dmg disk image is also in
HFS, so that is why we choose it (also because
hdiutil can only resize HFS).
Ok, now you can run the command to create the sparse image. I'm showing you the command again:
Let's mount it so we can work on it.
Now we are going to copy the
BaseSystem.dmg image into our
To copy the image we are going to use the
asr command (you can check the man page asr(8) for more details).
Alright, this will copy the Base System inside our volume
/Volumes/install_build, so It will erase our
/Volumes/install_build and replace it with
/Volumes/macOS Base System/. If you check our
/Volumes/ you'll see it there.
BaseSystem.dmg includes symbolic links to the Packages directory. When we are installing the OS with the application that symbolic link will exist. But in our case, that symbolic link points to the wrong place. You can verify this by listing the contents in
/Volumes/macOS Base System/System/Installation/.
What we are going to do is replace that symbolic link with the contents of the Packages directory we find in our
InstallESD.dmg that we mounted in
/Volumes/install_app. We can
rm and then
cp Or we can use the
We also need to copy some installer dependencies, i.e.
BaseSystem.dmg, and add them to the image. We find those two files in
/Applications/Install macOS Catalina.app/Contents/SharedSupport, let's list that directory:
Ok, now that we know where they are let's copy them to our image volume:
That's it. That is our image ready. Let's now unmount the images, clean up and prepare to convert our installation image to a read-only image.
Let's clean up and resize to free up any extra space.
hdiutil can only resize filesystems of type
HFS+. Again, read the man page for additional information on resize (hdiutil(1)). We can obtain the current size of the image using the
NOTE: as pointed out by quantum_libet we can simplify by using the
size -min parameter, this is much more clean than my previous solution. Thanks for the tip!
Now we are ready to convert the image to a
CD-R export image. You can see how to do this in the man page in the examples section (hdiutil(1), as you can see a lot of information in the man page).
And that's it. We now have the
Catalina.iso. We can use our ISO in VirtualBox to create our macOS Virtual machine!
Alright, now for the ugly part. VirtualBox doesn't support APFS in their UEFI boot loader (you can read the discussion in VirtualBox's forum). Luckily Alexander Willner created a handy script with the name runMacOSinVirtualBox that automates the creation of a VirtualBox VM that works. The script creates a bootable partition that can be used to boot macOS while we wait for VirtualBox to support APFS.
His script can also be used to create an ISO, but we have already done that, so no need.
Ok clone or download his script and run it.
Can You Convert Dmg To Iso
Now we can go to VirtualBox, and add our ISO image as an optical drive to the newly created VM.
Settings > Storage > Add New Optical Drive and select our newly created
Now you can start the VM. Now select
Disk Utility and format your macOS partition using APFS (click Erase and select APF). After the formatting is complete, quit Disk Utility and click 'Reinstall macOS'. Follow and complete the installation process.
Congratulations! You now have Catalina running on VirtualBox :).
We could have copy/paste or cloned the scripts created by Alexander Willner, Jeff Greeling or Kedy Liu. But I believe it's helpful to understand any code we use so we can build on top of that knowledge.
We learned how to work with Disk Images. As you can see, it is a convenient topic to understand. For example, some people distribute their applications outside the AppStore using
And also you now have a VM that you can use to build your security lab or to explore Kernel Debugging.
Ok, that's it for this post. I hope that you found this post useful :).
I also would like to thank all the people that very openly share their knowledge and help us understand how things work. I think the metaphor standing on the shoulders of giants, is quite apt.
Most of the links I'll add here are already in the post but for convenience I'll add them again.
- A detailed article on the structure of the macOS Installation App - AFP548.
- Jeff Geerling's macOS VirtualBox VM script.
- Kedy Liu's article on macOS Kernel Debugging.
- Alexander Willner handy script runMacOSinVirtualBox.
- Documentation on Apple partition Map and GUID Partition Table.
Convert Dmg To Iso Pc
Convert DMG to ISO
You are here: Tutorials > Convert DMG to ISO
Dmg file is the disc image file which is widely used by Mac systems. Most of Mac operating systems and applications are distributed in dmg files. On Windows PC, it is very convenient to manipulate dmg files with PowerISO. You can open dmg file, convert it to iso file, or burn it to a CD / DVD disc. To convert it to iso file, please follow the steps,
Convert BIN to ISO
Copyright 2004-2021 Power Software Ltd. All rights reserved.