Create RAM disk in macOS High Sierra (10.13.3), macOS Monterey (12.6.5) ARM, macOS Sonoma (14.5) ARM, macOS Sequoia (15.7.1)
Tested on macOS Monterey (12.6.5) with Apple M1 Pro chip (ARM architecture)
Tested on macOS Sonoma (14.5) with Apple M1 Pro chip (ARM architecture)
Tested on macOS Sequoia (15.7.1) with Apple M4 chip (ARM architecture)
diskutil listhdiutil attach -nomount -nobrowse ram://120000 # 120000 * 512bytes = ~ 61.4 MB RAM disk
# 6000000 = ~ 3 GB RAM disk
newfs_hfs /dev/disk* # <- * is number generated by previous command
# Aware: '/tmp/ramdisk' path MUST exist first
mount -t hfs -v /dev/disk* /tmp/ramdisk # <- * is number generated by previous commandumount /tmp/ramdisk
hdiutil detach /dev/disk* # <- * is number generated by previous command