Automatically open Finder when disk image is mounted
I created a Disk Image (.dmg) with Disk Utility with the APFS filesystem. When i open the .dmg it gets mounted, and i can go to finder and manually open it.
How do i make Finder automatically open a new window with the .dmg contents when i open/mount the .dmg?
(macOS Catalina, 10.15)
As a test, I created a 100 MB APFS disk image and saved it to the default location, in my Documents folder. I then unmounted the disk image, as it needed to be unmounted to test what I did next.
Next, in Automator, I created a new Folder Action, while setting Folder Action receives files and folders to Volumes
. I did this by clicking Choose folder > Other… and then pressed ⇧⌘G to bring up the Go to the folder: sheet. I then typed in /Volumes
and clicked the Go button, followed by the Choose button.
Next I added an Open Finder Items action and saved the Folder Action as e.g. Open Mounted Disk
From Finder, I then doubled-clicked the APSF.dmg file and when it was mounted, it opened a new Finder window to the root of the mounted disk image.
- Note that when the disk image opened, I was prompted with a message "FolderActionsDispatcher" would like to access files in your Documents folder, to which I clicked the OK button. This created an entry in System Preferences > Security & Privacy > Privacy > Files and Folders as FolderActionsDispatcher with a [√] Documents Folder checkbox.
-
The e.g. Open Mounted Disk.workflow was by default saved to:
/Users/$USER/Library/Workflows/Applications/Folder Actions/