RAM disks are available since 1979. They offer a filesystem in RAM and therefore outperform most of all other storage systems. This can be used to do disk intensive operations in a fraction of the normally required time. This article covers Mac OS X 10.5 and later. If you STILL use earlier versions take a look at the article posted by OSXDaily.
Mac OS X includes a way to create RAM disks using the following Terminal command:
diskutil erasevolume HFS+ 'My 4GB RAM Disk' `hdiutil attach -nomount ram://8388608`
The size of the disk is based on the page size number of 512 bytes sectors. That means the size in bytes has to be divided by 512. For example to calculate the size parameter for a volume with 4GiB the following formular is used:
Be aware that the content of a RAM disk is permanently deleted as soon as it is ejected! Only use it as temporary storage!
RAMDiskCreator
To simplify the process I created RAMDiskCreator. It’s a freely available tool and offers a graphical user interface for the RAM disk creation. Only the size and the volume name have to be provided. In the background the same command is used as described above.
You can download RAMDiskCreator 1.4 for Mountain Lion or better here. If you are still on Lion or Snow Leopard please download RAMDiskCreator 1.2. Furthermore I will happily provide the source code on request.
Changelog
- 2014-04-26 – Version 1.4: Fixed a bug that could lead to a wrong RAM disk size (Thanks to John VanDyk for reporting)
- 2014-04-10 – Version 1.3: The configuration is stored after a successful RAM disk creation for easier usage (Thanks to rxflyer for suggesting this feature)
- 2013-05-24 – Version 1.2: Fixed broken free memory calculation (Thanks Dave for reporting)
- 2012-12-28 – Version 1.0: Initial version released