Skip to content

Instantly share code, notes, and snippets.

@dhlavaty
Last active April 24, 2023 15:35
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dhlavaty/aa6ea374bd0ac72f67f4108d4f83907d to your computer and use it in GitHub Desktop.
Save dhlavaty/aa6ea374bd0ac72f67f4108d4f83907d to your computer and use it in GitHub Desktop.
Create RAM disk in macOS High Sierra (10.13.3)

Create RAM disk in macOS High Sierra (10.13.3), macOS Monterey (12.6.5) with ARM processor

Update 2023-04-24

Tested on macOS Monterey (12.6.5) with Apple M1 Pro chip (ARM architecture)

LIST DISKS

diskutil list

RAMDISK CREATE

hdiutil attach -nomount -nobrowse ram://120000      # 120000 * 512bytes = ~ 61.4 MB 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 command

RAMDISK DELETE

umount /tmp/ramdisk

hdiutil detach /dev/disk*                           # <- * is number generated by previous command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment