I have a.dmg MacOS package (with 'continue' buttons, EULA etc) that i need to install on multiple computers. Is it a way to do so silently via a bash/python/ruby/etc script just like silent MSI. If you want to script the install it requires a few more steps since the name of the.dmg file, the name of the Volume created, the name of the application, and the name of the device that needs to be detached can all be different. Plus they can have spaces in them. Also a.dmg can have an.app file or a.pkg file in it and these require different behavior.
- How To Install Dmg File On Mac Using Terminal
- How To Install Dmg File From Terminal
- How To Install Dmg File Using Terminal Digit
- How To Install Dmg File Using Terminal In Mint
- How To Install Dmg Files
So you’re running Linux on your computer, maybe Ubuntu, and you have some files with the .dmg extension. In this guide, we’re going to talk about how to open, mount, extract, and otherwise get your files from these pesky DMG images. You could always just extract the files on a Mac, then transfer them back to your Linux machine. But if you really want to do this on Linux, without having to rely on Mac, here’s how to do it.
What are DMG image files?
Simply put, it’s a kind of image file. But not an image like a jpeg is an image. DMG is Apple’s proprietary disk image format, native to Mac OS X. There are actually a whole bunch of different types, format and options within this format. There are options for encryption, compression, and different kinds of partition schemes, among others. Unfortunately, this can make things pretty confusing when we’re trying to gain access to the data contained in one of these images.
DMG images are typically a kind of Universal Disk Image Format (UDIF), although there are others, namely NDIF and SPARSE. Although the .dmg file extension is usually used, they can also sometimes have an .img extension, or in some cases no extension at all. Their MIME type is application/x-apple-diskimage.
The HFS/HFS+ (Mac OS Extended/Journaled) file system is typically used in DMGs. However, this isn’t always the case. You may also sometimes find FAT and ExFAT files systems, as well as variations on HFS.
Does my system support DMG?
Perhaps the biggest hurdle to overcome when trying to work with DMG files is working with the HFS file system (Mac OS Extended). Linux supports HFS through the “hfs” and “hfsplus” kernel modules.
There’s an easy way to test if your system has these kernel modules. Plug in a USB drive formatted with the Mac OS Extended file system. If your particular distribution doesn’t have the appropriate modules, you will likely get an error message. On Ubuntu, you’ll get a popup window declaring “Ubuntu: Unable to mount
Alternatively, we can see if the kernel module files are present with find:
We want to see two files: “hfs.ko” and “hfsplus.ko”. If find doesn’t return these files, your system probably doesn’t support HFS.
You could also try “modinfo”: modinfo hfs
and modinfo hfsplus
should return something like:
If you get 'modinfo: ERROR: Module hfsplus not found
' your system doesn’t have these modules.
Not all Linux kernels and distributions support HFS. This is especially the case for certain distributions that are a few years old. If you have kernel support for HFS, great! If not, don’t worry. There are still ways to extract data from your DMG files. While it’s nice to have the option to mount the images we’re working with, this is really the only functionality we’re losing without having the hfs and hfsplus modules. The two programs we’re going to use later on (P7ZIP and dmg2img) do not require kernel support to function.
What kinds of DMG images can be opened in Linux?
This guide is about how to open, mount, and extract files from read/write, read only, and compressed DMG image files. The following partition schemes have all been tested with the techniques discussed here.
- Apple Partition Map
- CD/DVD (partitioned)
- CD/DVD (partitioned) with ISO data
- Hard disk
- Master Boot Record Partition Map
- No partition map
This guide does not cover how to handle sparse disk images (.sparseimage), sparse bundle disk images (.sparsebundle), or CD/DVD masters. DMG images with partition scheme types of “CD/DVD” and “GUID Partition Map” do not appear to work with the techniques described here.
Option 1: Mount the DMG
If the Linux distribution you’re on has HFS support in the kernel (Ubuntu 14.04.1 LTS supports it), it’s pretty easy to just mount the DMG image:
We’re using “sudo” because we need root privileges to mount things. The HFS+ file system type is specified with “-t hfsplus”. The “/mnt” at the end of the command specifies where we’re mounting the image.
Unmount the image with sudo umount /mnt
If you get a wrong fs type message like the one below, it means the DMG file is either of an unsupported type, or it’s compressed. Unsupported images include sparse images, sparse disk bundles, CD/DVD masters, and images with partition schemes of the CD/DVD or GUID Partition Map types.
Use “file” to learn a little more about the image file:
If you get image.dmg: x86boot sector
that means it’s probably using a GUID Partition Map and isn’t supported. This isn’t good, however, it’s also not too terribly common.
How To Install Dmg File On Mac Using Terminal
What’s more common is to see something like this:
If mounting isn’t working, and this is what you’re seeing with “file image.dmg”, then you’re luck!. Our problems are being caused by compression. Linux doesn’t like to mount compressed DMG images. To get around this little obstacle, we’ll use dmg2img (see below).
Option 2: Use dmg2img for compressed images
So you have a DMG image that you can’t mount because it’s compressed. You’ve done “file compressed_image.dmg” and you got “compressed_image.dmg: bzip2 compressed data”. The fix? That’s easy: use dmg2img to convert it to an uncompressed image. Once you run the image through dmg2img you should be able to mount it no problem.
Don’t have dmg2img? It’s usually pretty easy to get using your distribution’s package management. On Ubuntu, you’d do:
How To Install Dmg File From Terminal
Using dmg2img isn’t very difficult. Type “dmg2img” into the command line followed by the name of the DMG file you want to decompress. The Mac OS X version of Firefox is a good example of a compressed DMG file.
Now mount the resulting .img file:
Option 3: Extract DMG contents with P7ZIP
P7ZIP is awesome. It’s the Linux/BSD version of 7-Zip. Check out their SourceForge page here With it you can literally extract files from any kind of image or archive. Just kidding… It doesn’t really work with every format conceivable. However, it can handle (in alphabetical order): ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, RAR, RPM, SquashFS, UDF, VHD, WIM, XAR and Z. Impressed? I certainly am!
Installing p7zip is pretty easy using your distribution’s package management system. On Ubuntu with apt-get:
In addition to being able to extract data from compressed and uncompressed images alike, P7ZIP doesn’t require the HFS kernel modules at all. In the example below, we’re going to extract all of the files from “Firefox 33.1.1.dmg”. When we’re done, we’ll have a tidy little folder called “Firefox”.
Invoke P7ZIP to extract archives and images with “7z x”.
Notice that 7z extracted three files: “0.ddm”, “1.Apple_partition_map”, and “2.hfs”. To actually get to the files, we’ll need to run 7z again on “2.hfs”.
We picked “2.hfs” because it was the biggest of the three, meaning it was probably the one with the data. Simple but effective logic. After a few moments, you should have a folder called “Firefox” with all of the files from the original DMG.
Learning how to create a bootable macOS installation disk can be helpful in a variety of situations. Rather than download and install a new OS from Apple's servers each time, it can be used for multiple installations on different machines. It can also help in situations where the operating system is corrupted or installation from app store shows errors.
To create a bootable macOS installation disk, you have to burn the DMG file to a USB drive as CD/DVD is not available for Mac computers. Here's how to do it from text commands and using a purpose-built software called WizDMG. You will first need to download the DMG file for the macOS version you wish to install. For example, if you want to create a bootable macOS Mojave installer, you will need the DMG file for macOS Mojave. Once the file has been downloaded to your PC, you can proceed with one of the bootable disk creation methods shown below.
Method 1: How to Create Bootable USB Installer for Mac via Commands
macOS (formly named Mac OS X) is just a variant of popular Unix based operating system. This means a lot of daily and advanced tasks on Mac can be done via text commands such as creating bootable USB installer for Mac. However, this could be a lot of challenges if you had no clue about commands and I suggest taking a look at the other solutions in this post to avoid messing up the computer with the wrong commands.
Step 1. Search macOS name in app store (Mojave, High Serria, EI Capitai). Click 'Get' button to download the installer image on your Mac. The downloaded file will be located in Application folder.
Step 2. When the download is completed, the installation windows opens automatically, just close the window and go to Application folder. You will find a file started Install, such as Install macOS Majave.
Step 3. Now connect an external flash drive with more than 16G free space. And backup the data in that USB drive as the installer erase all content from it. Open Disk Utility app and format the USB drive with APFS or Mac OS Extended.
Step 4. Open the Terminal app and copy-and-past the following commands to make a booatble USB installer from macOS image:
For Majove: sudo /Applications/Install macOS Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
For High Serria: sudo /Applications/Install macOS High Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume
For EI Capitan: sudo /Applications/Install OS X El Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install OS X El Capitan.app
Step 5. Input the admin password when being prompted. And wait for the booatable disk being created. When it is done successfully, you will receive a message shown in above screenshot.
Unconfortable with text commadns and prefer doing it in a simple way? The second suggestion is more user friendly!
Method 2: How to Make Bootable USB from macOS with WizDMG
WizDMG fills a huge gap in Windows not supporting DMG files. It is a desktop utility supporting Windows and Mac. It allows you to directly burn DMG files to disk in order to create a bootable macOS Mojave installer or a boot disk for any macOS version.
WizDMG offers an intuitive interface with no clutter and full functionality to handle DMG files. Apart from burning such disk image files to DVD/CD or USB, it also gives you edit options where you can add and remove files from within the DMG file, rename DMG files and even create DMGs from files and folders on your desktop. This software application has been created for novice users as well as experts. It is easy to use, has a very high burn success rate and will help you create a bootable macOS installer in no time. Follow the instructions below:
Step 1Install WizDMG
Download WizDMG from the official website and install it on your PC. Launch the program and select the 'Burn' option in the main interface.
Step 2Create Bootable USB from macOS Install Image
Click on Load DMG to import the macOS installation file into the application. Insert a USB (16G free space) and click on the 'Burn' button next to the appropriate media type.
The important thing to remember here is that you now know how to create a macOS installer in Windows. There aren't a lot of options out there because of the compatibility issues between Mac and Windows environments. That means converting DMG to ISO and back again to DMG leaves the door open for corrupted files and incorrectly burned bootable media, which defeats the whole purpose because it might not even work in the end.
Method 3: Create macOS High Serria/Mojave Bootable USB on Windows 10/7
Another way to create macoS bootable disk on Windows is using a tool called DMG2IMG along with Windows command prompt. It requires a bit of a workaround, but even novice users can learn to burn a DMG file to a disk to create bootable media for a macOS installation. Just make sure you follow the instructions below carefully.
Step 1. Download DMG2IMG and install it in your Windows PC. Open File Explorer and go to the folder containing the DMG2IMG program, then right-click and select 'Open command windows here.'
Step 2. Type the following command and hit Enter: dmg2img [sourcefile.dmg] [destinationfile.iso]
Step 3. Now that the DMG file has been converted to ISO format, you can use the following command to burn it to a disk. Before that, insert a disk into the optical drive: isoburn.exe /Q E: 'C:UsersUsernameDesktopdestinationfile.iso'
How To Install Dmg File Using Terminal Digit
Step 4. This command utilizes the Windows native disk image burner to burn the ISO to the disk in your optical drive. The ISO file can't be used directly in macOS, but it can be mounted as a virtual drive. Once you do this, you can convert it back to DMG using Disk Utility in Mac. You can then use this as your bootable macOS installer.
As you can see, this is a bit of a workaround because DMG files aren't natively supported in Windows. Likewise, ISO files aren't fully supported in macOS. However, you can use this method to create a macOS installation disk in Windows. If you want a much simpler solution, then review the next method shown here.
Summary
If you ask us how to create a bootable macOS installation disk, this is the method we recommend. There's no confusing command line work involved, you don't need a bunch of additional software utilities to get the job done, and the high accuracy of the application ensures that you won't be wasting disk after disk trying to burn the installation media for macOS onto a disk. Use WizDMG as a quick and painless way to create a macOS installation disk in a very short time.