How to create a disk image on Mac OS. Creating a beautiful .dmg image for a program in OS X. Creating a bootable USB flash drive for Mac OS

Most users are faced with the problem of creating a boot disk for Apple computers when reinstalling the system.

This guide will help you create boot disk and rebuild the system from scratch.

Before you begin reinstalling the system, make sure that you have everything you need:

  • Flash drive with at least 8 GB. The flash drive should not contain important files, since during preparation we will have to format it. Or DVD DL (dual layer DVD disc)
  • iLife 11

If you purchased Mac OS X Lion or Mac OS Mountain Lion and you don’t have an image - don’t worry, you need to click on the operating system installer, which is located in the program folder, right-click and click “Show package contents”

The contents of the installer will open in a new window. Go to Contents->SharedSupport folder and copy InstallESD.dmg to your desktop. This is your boot image.

Everything necessary has been sorted out. Now you need to carry out simple manipulations to prepare an installation flash drive or burn the installation image to a DVD DL disk.

Creating a bootable Mac OS USB flash drive.

1) Open the Disk Utility program, which is located on the path Finder->Programs->Utilities

2) In the top menu, click File -> Open disk image, and select your installation system image

3) Insert the flash drive and make sure it shows up in Disk Utility

4) Click on it and go to the "Disk Partition" menu

5) In the “Partition Scheme” drop-down menu, select “Partition: 1”

6) Just below is the “Options” button, click on it and check the box next to “GUID Partition Scheme”

7) And in the “Format” section, select the disk format “Mac OS Extended (Journaled)” as shown in the picture below, and enter it to your liking

10) Click on the “Apply” button for the changes to take effect. Let us remind you: all data from the flash drive will be deleted

Now all we have to do is clone the image onto a flash drive. For this:

11) Go to the “Restore” tab and drag the USB flash drive to the “Destination” item, and the image to the “Source” item

12) Click the "Restore" button

13) Disk Utility will warn you that it will delete all data from the flash drive, we agree by clicking on the “Erase” button

Copying takes up to 20 minutes. After which you can begin installing the operating system.

Creating a Mac OS boot disk.

Except bootable flash drive You can create a boot disk with the system. In some cases, this option is easier, for example, if you don’t have a flash drive at hand or you often reinstall the system.

As written above for the boot disk you will need:

  • installation system 10.7 or older
  • DVD DL disc (double layer DVD disc)
  • We highly recommend having installation disk with iLife 11 since iPhoto, iMovie, iDVD, GarageBand programs are not installed with the system, but come as a separate package.

1) Open the Disk Utility program, which is located on the path Finder->Programs->Utilities

2) From the top menu, click the “Burn” button and select your installation system image

3) After a short preparation and checking of the disc, the “Burn” button will light up, which you need to press to start recording to the disc.

Installing Mac OS from scratch

Now it's time to move on to installing the Mac OS operating system.

1) Turn off your computer.

2) Turn on the computer and hold down the Alt button until a selection of boot volumes appears.

3) To boot from the installation flash drive, double-click on it and wait for it to fully load.

4) 2-3 minutes after selecting the boot volume, you will be prompted to choose a language - choose a convenient one, for example Russian.

5) After a few seconds, you will see a window with utilities that will help you reinstall the operating system.

6) Run Disk Utility and format the disk, to do this follow steps 4-10 of this instruction, but not for the flash drive, but for the internal disk. Then close the program. As always, I have to warn you that all your files, data, programs, etc. will be deleted. If you want to save your data, use the instructions Setting up a backup copy on Mac OS

7) Now you will need the utility located just above - “Reinstall OS X”. This latest program which we need to use on our way to the reinstalled system. Launch it and follow the instructions that will be displayed on the screen.

If you have any difficulties or questions, they will make every effort to help you.

In order not to lose a configuration dear to your heart Mac settings OS X and a set of installed and correctly configured programs, you need to make backup copies of your operating system from time to time.

Despite the reliability and stability, MAC OS X may still “fall” due to incorrect user actions. And at the most inopportune moment. But no one wants to lose their personal, so dear to their hearts configuration of settings and a set of installed and correctly configured programs...

To avoid ending up in this situation, it is imperative to make backup copies of your operating system from time to time.

Unlike the numerous difficulties and prohibitions associated with cloning living beings, no one bothers you to create an exact copy of your Mac OS X on another piece of hardware.

Cloning animals is difficult, time-consuming and illegal, but operating systems are simple, fast and, in a sense, even mandatory

So, let's create our “apple” sheep Dolly.

Time Machine

There are many ways. First opportunity Reserve copy your system is built into MAC OS X itself, starting with version 10.5 and older. This is Time Machine.

Time Machine in automatic mode creates backup copies of the system and all important files on an external hard drive and must “go back in time” to restore system files to their original form at the time when you need it. If you turn on Time Machine in " System settings"(System Preferences), she herself will offer to create “backups” (spare copies) and will ask for a directory to save them.

But Time Machine has a couple of drawbacks. The first of them is that it eats up disk space very quickly. Although not completely. After the first backup is created, Time Machine continues to save only the changed files.

The second problem is that automatic copying interferes with normal operation, starting on its own.

To at least somehow level this out, let’s turn to an additional application that allows you to configure Time Machine itself.

This is TimeMachineEditor. You can download it. TimeMachineEditor will allow you to more flexibly customize the schedule of your procedures. For example, hourly on Mondays, daily after work, and so on.

Using this utility, we increase the intervals of “time jumps”, “curbing the appetite” of Time Machine itself, and adjust its backup sessions to a schedule convenient for us.

Thus, Time Machine has the ability to backup your system during various failures and “roll back” back, but it is cumbersome and not very convenient for this purpose. Including the “backup” disk is not bootable and for recovery it requires starting from the installation disk Mac drive Os X.

Disk Utility

Another way to “grow” your “clone sheep” is to use a standard disk utility. By default, it is located in the Applications/Utilites folder.

We launch this application and select the name of your system drive in the menu on the left, for example, X. Now drag the icon of your startup disk (X) into the “Source” line window, and drag the disk icon into the “Destination” line. which will save your clone, for example, Backup. This can be an external FireWire or USB disk, as well as an internal HDD or a flash drive of sufficient capacity.

If you need to pre-format this directory, switch to Erase. For external media, the format does not matter (as a rule, it is Mac OS Extended Journaled), and for a hard drive on a Mac with an Intel processor, it is preferable to select “GUID Partition Table”.

Now click “Restore” and enter your password. Go.

After some time, another “Dolly the Sheep” will appear - an absolute copy of your system disk.

Now, if your Mac OS X crashes fatally, and no “cure” will help, you can repeat this procedure in reverse, replacing the damaged system with your saved copy.

To do this, you need to “start” from the backup system itself: turn on your Mac while holding down the option key, then select the disk with the ready-made clone as bootable (in our example, Backup) and perform the recovery procedure in reverse order.

But before you do this, you must definitely try to “cure” the damaged system with the same “Disk Utility”.

Select the “damaged” disk in the left menu (in our example it is X and in the “First Aid” section do the following procedures: “Verify Disk Permission” and, if necessary, do “Restore access rights” ( Repair Disk Permission) and, accordingly, “Verify Disk” - “Repair Disk”.

The familiar OnyX program can also provide irreplaceable help here.

Despite the ease of cloning using Disk Utility, this method has one drawback. Absolutely all information, without exception, is copied. And if we're talking about about a small spare disk, or even a flash drive? The files may simply not fit on them.

What is the choice?

There are many options for cloning your Dolly the Sheep. Up to use command line according to instructions from Apple itself. “Mere mortals” may find other utilities more accessible, such as SuperDuper!, Clone X, Tri-BACKUP or MacTuneUp. In my opinion, the most advanced among them, convenient and at the same time absolutely free, is called Carbon Copy Cloner.

Carbon Copy Cloner is produced by Bombich Software. You can download it. Voluntary donations to developers (Donate) are welcome.

Mike Bombich, the creator of this wonderful program, in an interview with a popular American site, especially noted the “highlights” of his brainchild: the speed of the cloning process, the ability to selectively transfer data and additional protection against accidental actions in the form of a special list of all possible candidate disks with a request their ID (Unique Identifier).

Carbon Copy Cloner allows you to create a full or partial clone of your system, moving it to another disk or saving it as a .dmg (disk image). The latest versions of Carbon Copy Cloner, aimed at the Snow Leopard system, support compression in file system HFS+, displaying the sizes of folders and drives in the decimal system has become noticeably more convenient, copying speed has increased, and Time Machine databases are ignored if they have already been created.

Carbon Copy Cloner can be very useful when upgrading a system disk and replacing it with a more capacious one. It is enough to transfer the previously rejected system to a new disk.

Before you start creating a backup copy of your system, it would be a good idea to first clean out all the “garbage” that has accumulated on the system using the OnyX utility and put it in order.

Install Carbon Copy Cloner and launch it. If necessary during operation, enter your usual password and unlock the “lock” at the bottom left.

At the top left in the Source Disk menu, select the one from which your system will be cloned (in our example, this is drive X).

At the top right Target Disk, select the one on which the “twin” of your MAC OS X will be saved. (In our case, X2. It is important to note that this utility has the ability to record the system in .dmg format and even to a remote computer over the network.

Now let's take a look at another feature of Carbon Copy Cloner: create special filters that allow you to exclude some files from the clone based on their extension, for example .mkv or .avi, and then movies of this format will not be cloned. This will help save space.

In order not to complicate your life, let's try to manually do some preliminary procedures to make the spare system easier and speed up the cloning process.

It is not necessary to save your entire media library to a system backup: digital photos, music, films, supporting documentation, and so on. And also work files that can weigh more than one gigabyte. You can also refuse "heavy programs" if there is not enough space on the backup disk.

Find Items to be copied in the left window and look carefully, unchecking some of the checkboxes opposite unnecessary files. If they are not stored haphazardly on your disk, then most likely they will be in the Users/macuser (your username) directories. For example, in this configuration we disable the Calibrie Library and the books it contains. After all, they are already recorded on a separate DVD.

Then in the section on the right Cloning options (Clone mode) select Incremental backups of selected items (incremental “backup” of selected items) this dynamic mode will allow you to transfer only the changed data the next time you update the version of the spare system. The checkbox below Delete items that don’t exist on the source in synchronization mode will not “take with you” old programs and other files that you have not used for a long time.

Protect root-level items on the target will keep you in superuser mode if you are one. And finally, Archive modified and deleted items will allow you to create a separate archive of modified and deleted files. In my opinion, it is better to disable this so as not to waste time.

If Carbon Copy Cloner “gives the go-ahead” - This volume will be bootable, - which means there is enough space on the spare disk or flash drive, and this volume will become bootable, you can start.

Any presets you've made will be saved if you click Save Task if you're planning to clone your drive on a specific schedule, like Time Machine. But to create backup Mac OS X is unlikely to be useful.

Click Clone.

How many files are stored on your system drive? It turns out tens of thousands. so the process may take some time: from fifteen minutes to an hour or two. It depends on the amount of information.

And so it ended. Now we have two “Dolly sheep” - mirrored Mac OS X. And you can be sure that you will not be left with nothing at the most inopportune moment.

A disk image is an ISO file that stores all the contents of the original media. There are other formats, but this is the most popular.

The computer recognizes the virtual image in the same way as a physical disk. Even if related files were stored on the original media, they will work correctly as an image. Therefore, most often they create disk images with installation files for games, programs and operating systems.

Modern OSes read ISO files without additional programs. On old ones operating systems For this you can use utilities like Daemon Tools. You can also open the image and view its contents using a regular archiver.

Why create disk images?

Let's say you bought a DVD/Blu-ray with a game or movie. Over time, scratches appear on it, which is why you can lose the recorded information. And the disk itself is easy to lose. In addition, it makes noise as it rotates in the drive, and the speed of reading data from it is lower than from computer memory. All these problems can be solved by creating a virtual disk image.

If the disk is copy protected, most likely it will not be possible to create an image of it.

Another example: you have a Windows distribution disk. It can be used for or OS, but a flash drive is much better suited for these purposes. Moreover, many modern computers do not have disk drives at all. But you can create a disk image and make a .

How to create a disk image in Windows

Ashampoo Burning Studio FREE is one of the most convenient utilities for creating disk images. Its interface has been translated into Russian, it takes up little space and is also free. During installation, the program asks license key, but you can receive it by email after quickly registering an account.

Immediately after launching the utility, select “Disk Image” → “Create Image”. Then insert a physical disk into the drive and wait until the program recognizes it, then click “Next”. Then specify the folder in which the image will be created and select the ISO format. Click “Next” again and wait for the copying to complete.




The disk image will appear in the location you specified in your computer's memory.

If for some reason you are not satisfied with this utility, you can use similar free programs like BurnAware Free or CDBurnerXP.

On a Mac, this can be done in the standard Disk Utility, available in Finder → Programs → Utilities. Once you have launched it, insert required disk into the drive and click in the top menu “File” → “New image” → “Image from [your disk name]”.

In the next window, enter the short name of the future image in Latin. Specify the desktop as the destination and select the “DVD/CD Master” format. After that, click “Save” and wait until the copying is completed.

The created image will appear on the desktop and will have a CDR extension. If you plan to use it only on , then you can leave this format. But for Windows computers to read it, you need to convert the CDR file to ISO.

To change the image format, run the Terminal utility. Type cd desktop and press Enter. Then enter the second command hdiutil makehybrid -iso -joliet -o [name 1].iso [name 2].cdr , after replacing [name 1] and [name 2] with the names of the future ISO file and the already created CDR file, respectively. Then press Enter again - after a while the ISO image will appear on the desktop.

Let's say we first created a CDR file called olddisk. Then we choose for the future ISO image, for example, the name newdisk. As a result, the commands for our case will look like this:

DAEMON Tools for Mac is our first image mounting solution dedicated to Mac OS fans. It allows, organizing virtual discs in the convenient collections and. Today I"d like to tell you about the absolutely fascinating feature which has been added to DAEMON Tools for Mac with the latest released version - the ability to.

I"ve already tested DAEMON Tools for Mac 3 and would recommend you to download the trial version and check it too. The new version offers brilliant Yosemite-styled design, improved iSCSI Initiator feature and the ability to create ISO image from files that I"d like to tell you more about. So, click the download button below, it is completely free of charge!

Why do I need to create ISO image on Mac?

People who have never tried to create ISO image on Mac may wonder why this feature is so essential. Let's discuss the most popular cases. First of all, it is cool to create image from folder to archive some data. DAEMON Tools for Mac allows you not only to create a perfect backup of the important files but also compress them in order to save the hard disk space.

The next case which requires you to create ISO image from files is related to important private information. An encrypted image is the easiest and the most effective way to protect valuable data with password. Later you will be able not only to use this image on Mac but copy to USB-stick and don"t worry if someone gets unauthorized access to it.

And of course, after you create ISO image from files, you will have plenty of ways to use it. I"ve already mentioned about secured images copied to USB-stick, and that is not all. Image is a virtual disc, and you still can turn it into physical one or share over the network. Just use DAEMON Tools for Mac to create disk image, Mac OS" standard Disk Utility to burn it or DAEMON Tools iSCSI Target to .

Why do I want to know? My case is rather complex. I have lots of work files on my computer, and I"d like to create the backup of them. Of course, the files need to be secured and should not occupy too much space on the hard disk drive. I have a bit old- fashioned MacBook, which includes writable drive, so I will burn my custom image on DVD-R Let's try to. create image file from folder together with me and see how DAEMON Tools for Mac can cope with this task.

How to create an ISO image on Mac?

Finally, we came to the main question of this post — how to create an ISO image on Mac using DAEMON Tools. Let's do it together.

I"ve downloaded and installed DAEMON Tools for Mac 3 and opened its main window. Then:


It is great to know how to create an ISO image on Mac, and there are plenty of ways to use it. I hope you will try this useful feature and write me in the comments about your impressions.

  • Tutorial

Greetings to the honorable residents of Habr!

Today I will tell you how to beautifully present the installer of your program to the user. Surely everyone who uses not only programs from the AppStore has come across beautiful .dmg disk images, like Adium’s, for example. This image is, so to speak, an interactive installer, in which a clear hint is given: drag the icon here. Everything is extremely clear and simple.

Of course, for an experienced poppy grower, a zip archive will do, but everyone likes it to be beautiful and convenient. So you and I, dear readers, will take care today of creating such a beautiful disk image for our (or someone else’s) program.


You can, of course, do this all manually, but this not_our_method™, so we will write a shell script to automate this process. Automation will also be useful to us in the event of putting into operation a build server, then this server will not only assemble the program from source code, but also make a disk image for distribution.

If you don't need to know How This script works, but all you need is tool- at the end there is a link to a very universal script, ready for use.

Action plan in brief:

  • Copy the bundle to a temporary directory
  • Create a disk image from a temporary directory that is readable and writable
  • Mount the resulting image
  • Customize the appearance of the image using AppleScript: create a symlink for /Applications, set the background and arrangement of elements
  • Set an icon for the disk image
  • Unmount image
  • Convert image to compressed ridonley
  • Ready! You can post it on the website or in the Sparkle cast.
IMPORTANT! The script (more precisely, the part of it that uses AppleScript) will not work properly if installed TotalFinder(or a similar thing), and this can lead to unpredictable consequences! Seriously.

First, we need to determine what we will pack and what image name we will get at the end. To do this, we write in the script like this:

TMP_DIR="./tmp" APP_BUNDLE_NAME="MyGreatApplication.app" APP_VERSION=`/usr/libexec/PlistBuddy -c "Print:CFBundleShortVersionString" "$(APP_BUNDLE_NAME)/Contents/Info.plist"` APP_BUILD_VERSION=`/usr/libexec /PlistBuddy -c "Print:CFBundleVersion" "$(APP_BUNDLE_NAME)/Contents/Info.plist"` DMG_NAME_BASE=$(APP_BUNDLE_NAME%.*) DMG_NAME_SUFFIX=" $(APP_VERSION).$(APP_BUILD_VERSION)" DMG_NAME="$(DMG_NAME_BASE) )$(DMG_NAME_SUFFIX).dmg" VOL_NAME=$(APP_BUNDLE_NAME%.*)
Here we set the name of the bundle that we will pack, and read the version and build of the program from it using the PlistBuddy utility and set them as a suffix for the file name of the future disk image. When mounting, we set the name of the image simply as the name of the bundle without an extension.

To create a temporary disk image, use the hdiutil program by calling it with the following parameters

Hdiutil create -ov -srcfolder $(TMP_DIR) -format UDRW -volname "$(VOL_NAME)" "$(DMG_NAME_TMP)"
Here the parameters TMP_DIR, VOL_NAME and DMG_NAME_TMP are the temporary directory, the name of the image (which will be displayed when mounted) and the name of the temporary.dmg file, respectively. The -format UDRW parameter specifies the image type: UDIF image for reading and writing. We need the ability to write to disk for customization appearance mounted image. The -ov parameter tells the utility to overwrite the image in case we didn’t delete it last time.

Now we mount the resulting image (and save the device name for later use):

Device=$(hdiutil attach -readwrite -noverify -noautoopen $(DMG_NAME_TMP) | egrep "^/dev/" | sed 1q | awk "(print $1)")
Everything here is quite simple: we attach with read and write rights, do not automatically open the finder window, and then get a name like /dev/disk2 using egrep, sed and awk and parse the hdiutil output.

Now let’s copy the background image and icon onto the image, which are, for example, in the resources of our bundle (although, of course, they can be taken from any other place):

BG_FOLDER="/Volumes/$(VOL_NAME)/.background" mkdir "$(BG_FOLDER)" cp "$(APP_BUNDLE_NAME)/Contents/Resources/$(BG_IMG_NAME)" "$(BG_FOLDER)/" ICON_FOLDER="/Volumes/ $(VOL_NAME)" cp "$(APP_BUNDLE_NAME)/Contents/Resources/$(VOL_ICON_NAME)" "$(ICON_FOLDER)/.VolumeIcon.icns"
Next, we need to customize the mounted image; this can be done manually through Finder, but we will do something more cunning: we will force Finder to do everything automatically via AppleScript. There is a utility to call such scripts from the shell osascript, to which we will feed the following blank as input:

APPLESCRIPT=" tell application \"Finder\" tell disk \"$(VOL_NAME)\" open -- Setting view options set current view of container window to icon view set toolbar visible of container window to false set statusbar visible of container window to false set the bounds of container window to ($(WINDOW_LEFT), $(WINDOW_TOP), $(WINDOW_RIGHT), $(WINDOW_BOTTOM)) set theViewOptions to the icon view options of container window set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 72 -- Settings background set background picture of theViewOptions to file \".background:$(BG_IMG_NAME)\" -- Adding symlink to /Applications make new alias file at container window to POSIX file \"/Applications\" with properties (name:\"Applications\") -- Reopening close open -- Rearranging set the position of item \"Applications\" to ($(APPS_X), $(APPS_Y)) set the position of item \"$(APP_BUNDLE_NAME) \" to ($(BUNDLE_X), $(BUNDLE_Y)) -- Updating and sleeping for 5 secs update without registering applications delay 5 end tell end tell " echo "$APPLESCRIPT" | osascript
Of course, instead of VOL_NAME and other things, our shell script will substitute pre-prepared strings. This AppleScript tells the finder to open our mounted disk, set the necessary display parameters for it: remove the address and status bar, set the appearance of the “icon”, set the window size, icon size. All these parameters will be saved in a file .DS_Store. Next we set the background image copied earlier. Then we create a symlink (alias in AS terms) for /Applications, re-open the window to apply the changes. Now we set the position of the program icons and the created symlink, update and sleep for 5 seconds for reliability.

Now let's set the icon for the image using the SetFile utility:

SetFile -c icnC "$(ICON_FOLDER)/.VolumeIcon.icns" SetFile -a C "$(ICON_FOLDER)"
Next, install necessary rights for the disk image, synchronize (twice for reliability) and extract the image:

Chmod -Rf go-w /Volumes/"$(VOL_NAME)" sync sync hdiutil detach $(device)
That's it, now you can make the final disk image!

Hdiutil convert "$(DMG_NAME_TMP)" -format UDZO -imagekey zlib-level=9 -o "$(DMG_NAME)"
Here we use hdiutil to convert the temporary image into UDZO (UDIF compressed) format with compression level 9 (best). And at the end we get a disk image for distribution that has an attractive appearance!

The full script is included in the repository on GitHub. I note that in full version The script has a lot of possible input parameters (the parsing of which greatly increases its size), there is no hardcode at all (well, except for the default parameters). Well, the picture shown at the beginning of the post is obtained by calling my script as follows:

$ make_dmg.sh -V -b habr_logo_big.png -i habr_icon.icns -s "800:500" -c 535:345:253:345 "Hello Habr.app" Enabling version info in resulting dmg Setting background to habr_logo_big.png Setting icon to habr_icon.icns Setting window size to 800:500 Setting coordinates to 535:345:253:345 Bundle name set to Hello Habr.app Defaulting dmg volume name to Hello Habr *** Copying Hello Habr.app to the temporary dir ...done! *** Creating temporary dmg disk image......... created: /Users/silvansky/Projects/habr_demo_dmg/Hello Habr_tmp.dmg *** Mounting temporary image... done! (device /dev/disk1) *** Sleeping for 5 seconds... done! *** Setting style for temporary dmg image... * Copying background image... done!
* Copying volume icon... done!




Top