OSX‎ > ‎

Create RAM Disk from Memory RAM on OS X


Another great tip from one of our readers, Stephen Adelson writes: “Back in Mac OS 9 and earlier you could make a RAM disk, a temporary disk that was super fast because it was read from system memory, or RAM, and not a relatively slow moving hard drive. In Mac OS X the feature has been removed from an easy GUI interface, but you can get the same effect and create your own RAM disk directly by typing the following commands in any terminal window.” Follow Stephen’s instructions below to create a RAM disk in Mac OS X:

Create a RAM Disk in Mac OS X 10.5, 10.6, 10.7 or later

These instructions are to create a RAM disk in OS X 10.5 or later, if you have troubles with the below commands for earlier version of Mac OS, try the following to create a 550mb RAM disk:

diskutil erasevolume HFS+ "ramdisk" `hdiutil attach -nomount ram://1165430`

This has been tested and works in OS X 10.5.8, and 10.6.3, note that to remove the RAM disk you can simply eject it from the desktop as you would any other disk.

Create a RAM Disk in Mac OS X 10.4 and earlier

Type the following exactly in the Terminal (the $ represents a bash prompt and is not to be typed):

$ hdid -nomount ram://52428800
$ newfs_hfs /dev/disk1
$ mkdir /tmp/ramdisk1
$ mount -t hfs /dev/disk1 /tmp/ramdisk1

to ditch the RAM disk and unmount it, just type
$ hdiutil detach /dev/disk1

Source :