unpack_strategy/dmg: use diskutil image on macOS 14+ - #23414
Merged
Conversation
2 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Homebrew鈥檚 DMG unpack strategy to avoid hdiutil deprecation warnings on macOS 27+ by switching to diskutil image for image detection, attachment, and SLA-handling conversion while retaining the existing hdiutil behavior on older macOS versions.
Changes:
- Add an OS-gated
diskutil imagecode path for.can_extract?and DMG mounting/attachment on macOS 27+. - Introduce helpers to attach images with an isolated mount point and to convert SLA-bearing images for mounting.
- Add macOS 27-specific unit tests and OS extension hooks to enable the new behavior only on macOS.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Library/Homebrew/unpack_strategy/dmg.rb | Switch DMG detection/attach/convert to diskutil image on macOS 27+ and factor out helpers. |
| Library/Homebrew/test/unpack_strategy/dmg_spec.rb | Add specs covering diskutil vs hdiutil selection, isolated mount point, fallback attach, and SLA conversion. |
| Library/Homebrew/extend/os/unpack_strategy/dmg.rb | Add OS-specific loader for DMG unpack strategy extensions on macOS. |
| Library/Homebrew/extend/os/mac/unpack_strategy/dmg.rb | Define the macOS 27+ predicate (diskutil_image?) used to switch implementations. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
p-linnane
force-pushed
the
dmg-diskutil-image
branch
from
August 3, 2026 18:39
fad6773 to
73b395b
Compare
MikeMcQuaid
approved these changes
Aug 3, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Thanks! If possible let's see what other macOS versions this works on?
p-linnane
force-pushed
the
dmg-diskutil-image
branch
from
August 3, 2026 18:50
73b395b to
820dc84
Compare
diskutil image on macOS 27diskutil image on macOS 14+
p-linnane
force-pushed
the
dmg-diskutil-image
branch
from
August 3, 2026 19:17
820dc84 to
8ef1bf7
Compare
Signed-off-by: Patrick Linnane <patrick@linnane.io>
p-linnane
force-pushed
the
dmg-diskutil-image
branch
from
August 3, 2026 20:02
8ef1bf7 to
7aaf445
Compare
MikeMcQuaid
reviewed
Aug 4, 2026
MikeMcQuaid
left a comment
Member
There was a problem hiding this comment.
Thanks, sorry, few more nits.
Signed-off-by: Patrick Linnane <patrick@linnane.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hdiutilis deprecated on macOS 27 and prints a deprecation warning on everyattach,imageinfo, andconvertcall, each one pointing atdiskutil imageas the replacement (also reported in #23401).diskutil image attachwas added in macOS 13, while image creation was added in macOS 14. Because SLA conversion requiresdiskutil image create from, this moves the DMG unpack strategy todiskutil imageon macOS 14 and newer and retains the existinghdiutilpath for older releases.On macOS 14 and newer we detect images with
diskutil image info --plist, attach read-only withnobrowseinto an isolated temporary mount point, fall back to a plain attach when an image has multiple mountable volumes (--mountPointonly supports a single mountable entity), and convert SLA-bearing images withdiskutil image create from. Both tools emit the samesystem-entities/mount-pointplist structure, so mount handling and ejection are unchanged.One detection difference is worth calling out.
diskutil image infoexits nonzero after printing the license agreement for an SLA-bearing image. When that occurs, detection confirms the file has a validkolyUDIF trailer directly. This avoids treating arbitrary failure output as a disk image without falling back to deprecatedhdiutilon the new path.Validated end-to-end on macOS 27 beta build 26A5388g, including SLA-bearing, multi-volume, and combined SLA/multi-volume images. The macOS 14 floor is based on the capability history documented by
diskutil(8); macOS 14 through 26 have not been exercised directly.diskutil image create from --format UDROpreserves embedded SLAs, whileRAWstrips them like the legacy UDTO conversion. This is observed prerelease behavior and should be rechecked before macOS 27 GA.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Claude Code (Opus 5) drafted the implementation and tests; I reviewed the diff, verified the new tests fail without the fix and pass with it, exercised real SLA-bearing and multi-volume disk images end-to-end on macOS 27, and ran
brew lgtm+ targeted specs.