Mount Disk Image

Summary: Demonstrates how to mount a disk image using AppleScript.
Requires: DropDMG 3.2.5
Last Modified: 2019-10-02

Description

This script shows how to mount disk images using DropDMG. See also the documentation for the Mount Image… command.

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

tell application "DropDMG"
    
set _file to POSIX file "/Users/<username>/MyFolder"
    
    
-- Equivalent to double-clicking the .dmg file in the Finder
    
mount disk image _file
    
    
-- Disable checksum verification to make mounting large disk images faster.
    
mount disk image _file without verification
    
    
-- Disable owners to give yourself access to all the files.
    
mount disk image _file without file ownership
    
    
-- Directly specify passphrase for encrypted disk image.
    
mount disk image _file passphrase "the passphrase"
    
    
-- Use a configuration's stored passphrase (in the keychain). This way your passphrase is never stored in cleartext.
    
mount disk image _file configuration name "Configuration Name"
    
    
-- Mount the image inside the Documents folder instead of as a volume on the desktop.
    
set _mountLocation to POSIX file "/Users/<username>/Documents/"
    
mount disk image _file mount location _mountLocation
    
    
-- Mount a read-write disk image so that the original .dmg file is not modified; instead, changes are saved to an adjacent shadow file.
    
mount disk image _file with shadow file
end tell