Skip to main content
11 votes
Accepted

How to create a read-only RAM disk on macOS from the command line?

Get the device number of the RAM disk: diskutil list (e.g. disk3) Add some content to the RAM disk 😉. Unmount the volume: diskutil umount disk3 Mount the RAM disk read-only: diskutil mount readOnly /...
klanomath's user avatar
  • 66.7k
9 votes
Accepted

All of a sudden can't open .dmg files on Monterey

I fixed it! - I recently ran a command to stop receiving annoying messages about umounted drives: sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.DiskArbitration....
Hackeron's user avatar
  • 266
6 votes
Accepted

Create dmg file on macOS 10.14 that can be opened on macOS 10.11

If the source folder is in a APFS volume, then by default a APFS volume will be created in the dmg file. This type of volume can not be read by El Capitan. The solution would be to create a dmg file ...
David Anderson's user avatar
4 votes
Accepted

Using hdiutil to create a blank .dmg image in the current directory

You got it all right. Just give it a name for the image file (the .dmg/.sparseimage), and maybe a name for the virtual volume, if you don't want it named "untitled": hdiutil create -size ...
Spiff's user avatar
  • 921
4 votes
Accepted

hdiutil within "darling" can't do anything but "attach" and "detach". Can it be improved or something else?

The hdiutil program you're running is not Apple's - it is a separate program made in the Darling project that just happens to be named hdiutil. They're probably hoping to eventually implement the ...
jksoegaard's user avatar
  • 78.5k
3 votes
Accepted

Can I attach a .dmg without mounting the drive that it is sitting in?

If you mount a drive one of the things which happens is that the file system type gets identified so macOS afterwards knows how to access the content of the drive (and find the DMG for instance). So ...
nohillside's user avatar
  • 102k
2 votes

How to Mount a Sparsebundle Disk Image from Time Machine Backup?

If you are ok with creating a temporary shadow file, you can mount it this way: hdiutil attach -shadow /path/to/store/the/temporary/file.shadow /Volumes/Backup/Backups.backupdb/MachineName/Latest/...
bowmasters's user avatar
2 votes

How to mount the pc/iso partition of an iso file when it also contains an HFS partition?

You can check that the .iso file does indeed have an HFS/HFS+ volume on it with the file command (I can't remember if this is native or if I installed it via homebrew... might have to do that yourself)...
John O's user avatar
  • 391
2 votes
Accepted

How to calculate RAM disk size on OS X Mojave—500 or 512 byte block size?

This seems simple enough. You asked for 12000000 sectors. The sector size is 512 bytes. So 12000000 * 512 = 6.1 GB which is the size of disk15. If a block size of 500 bytes was substituted for the 512 ...
David Anderson's user avatar
2 votes

How to create a read-only shadow for existing RAM disk on macOS?

Start by finding the device node for your RAM disk by running the following in the Terminal: diskutil list You'll find that the ram disk is probably listed as something like disk3, disk4 or similar. ...
jksoegaard's user avatar
  • 78.5k
1 vote

How to attach a DMG with different mount AND browse name?

Updated Answer The Finder application posts the name of a mounted volume. This is stored in the volume itself. If the volume is mounted read-only then the name cannot be changed. So, your question is ...
David Anderson's user avatar
1 vote

hdiutil: create failed - Operation timed out

Okay, after watching the YouTube video how to make Time Machine backup on windows shared drive I was able to get this working. In Disk Utility, we can't use APFS, we have to create a disk image with ...
Eric Kolotyluk's user avatar
1 vote
Accepted

Error hdiutil: create failed - File exists -> but the file does not exist until this command fails

This is a workaround for the issue, but not a resolution. This allows me to use the image on the NFS share, but I still can't create it directly on the NFS share. % hdiutil create -size 300g -type ...
James Risner's user avatar
1 vote
Accepted

Shrink disk image to eliminate free space

Passing -imageonly to hdiutil resize seemed to do the trick: hdiutil resize -sectors min -imageonly image.dmg After this command completes, the size of the disk has shrunk to 15 GB and the free space ...
rgov's user avatar
  • 589
1 vote

How extract a Time Machine snapshot as a full machine volume?

I know that you are preferably looking for a command line solution, but have you checked Carbon Copy Cloner or Super Duper to see if they shouldn't be able to copy the whole Time Machine folder to ...
max1mvs's user avatar
  • 39
1 vote

Creating floppy disk images from folders of data files for VirtualBox

I executed the command from your question, which is also shown below. hdiutil create -size 1440k -fs "MS-DOS FAT12" -layout NONE -srcfolder disk2 -format UDRW -ov diskimage2.ima A ...
David Anderson's user avatar
1 vote
Accepted

How to properly unmount image (dmg / sparsebundle)

The man page for hdiutil(1) states detach dev_name [-force] detach a disk image and terminate any associated process. dev_name is a partial /dev node path (e.g. "disk1"). As ...
pion's user avatar
  • 4,876
1 vote

hdiutil convert -format UDRW not truly editable

This might help people who are still running into this issue. In my case, the DMG was mounted which gave the error "Resource temporarily unavailable", when I tried to use "hdiutil ...
Tanzeel Hassan's user avatar
1 vote

How to mount a .dmg file with a different volume name (or modify it once mounted)?

It sounds like your disk image is in a non-writable format. If this is the case, try converting your disk image to a writable one, using Images > Convert in Disk Utility's menu bar, and selecting &...
chuckaeronut's user avatar
1 vote

hdiutil attach -shadow not working

Alas, it seems that either macOS has changed the format of .shadow files in a breaking way, or that my .shadow files are corrupted (hundreds of them) without any corruption to the DMGs themselves (...
Matthew Strax-Haber's user avatar
1 vote

Can I attach a .dmg without mounting the drive that it is sitting in?

The reason testdisk fails is because it needs to write to the device, but your dmg is probably stored in read-only format, so it is not able to write to the virtual device that represents the dmg. ...
Joy Jin's user avatar
  • 2,823
1 vote

How can I hide a ramdisk from Finder?

Try chflags hidden "/Volumes/RamDisk" And restart your finder with killall Finder
Udhy's user avatar
  • 6,767
1 vote
Accepted

How to remove files from a sparsebundle file (previous Time Machine image)?

So the comment @GordonDavisson gave above got me thinking about permissions and with a little extra searching I ended up finding this answer to How can I delete Time Machine files using the ...
ParanoidGeek's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible