Skip to content

Instantly share code, notes, and snippets.

@fatso83
Forked from htr3n/macos-ramdisk.md
Created November 20, 2023 05:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatso83/f9adc63c5214f0a76ca7c54f8ab14265 to your computer and use it in GitHub Desktop.
Save fatso83/f9adc63c5214f0a76ca7c54f8ab14265 to your computer and use it in GitHub Desktop.
Creating RAM disk in macOS

Built-in

diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nobrowse -nomount ram://XXXXX`

where XXXXX is the size of the RAM disk in terms of memory blocks.

Notes:

$2048$ memory blocks correspond to 1MB. Thus, XXXXX = YYYY * 2048 where YYYY is the size in MB.

E.g.

  • ram://2048 will create 1MB RAM disk
  • ram://2097152 --> 1 GB
  • ram://4194304 --> 2 GB
  • ram://8388608 --> 4 GB

Third-party Tools

  • TmpDisk:: Open Source RAM disk management app.
  • Ultra RAM Disk installs as a menu bar item that allows you to create RAM disks when needed.
  • RAMDisk: is an app for creating as well as backing up RAM disks, to allow you to save their contents as well as restore RAM disks when you restart your Mac.
  • RAMDiskCreator

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment