Stop Safari auto-opening zip and dmg files
Download a .zip in Safari and it expands into a folder before you blink; download a .dmg and a disk image mounts on your desktop on its own. That's Safari's "open safe files" setting treating archives and disk images as safe to open automatically. Untick it in Safari → Settings → General and both types just sit in Downloads until you open them yourself.
Why zips unzip and dmgs mount by themselves
Safari's "safe" list includes archives and disk images, and "opening" them means expanding or mounting. So a .zip gets unarchived — leaving you with both the archive and an unpacked folder cluttering Downloads — and a .dmg gets mounted, adding a drive to your desktop and often auto-showing an installer window. It's meant to save a step, but it makes a mess, and it means a disk image starts presenting its contents before you've decided you want it. Turning it off gives you back the moment of choice.
Turn off auto-open for archives and images
- Open Safari and choose Safari → Settings (Cmd+,).
- Go to the General tab.
- Uncheck Open "safe" files after downloading.
Now a downloaded .zip stays zipped and a .dmg stays a file. To do it from Terminal instead — with the undo line ready:
# Keep zips and disk images from opening automatically
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Undo — allow safe files to auto-open again
defaults write com.apple.Safari AutoOpenSafeDownloads -bool true
Quit and reopen Safari to apply it. Note the command only works if Terminal has Full Disk Access, since Safari's preferences live in a protected container — otherwise use the checkbox. Verified on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia.
Now you're in control
With auto-open off, you open archives and images deliberately:
- Expand a zip: double-click it in Finder and Archive Utility unpacks it next to the original. Only the folder you asked for appears.
- Mount a dmg: double-click it, and it mounts just as before — but only when you say so. Drag the app to Applications, then eject the disk image from the Finder sidebar and delete the
.dmg. - Preview first: select the file and press Space for Quick Look, or Cmd+I to confirm the type and source before touching it.
Mainspring turns Safari's "open safe files" setting into a labelled, reversible toggle — no Terminal, no Full Disk Access — so zips and disk images stop opening on their own. It's one of 90+ hidden macOS settings it exposes.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once
Working with other archive types
This setting covers the archive formats Safari expands and the disk images it mounts. For formats macOS doesn't open natively, you'll need a tool either way — see opening RAR files — and if leftover disk images pile up, clearing out old .dmg files reclaims real space.