Dec 282012

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!


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.


  • 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

  32 Responses to “How to Create a RAM Disk – The Easy Way”

  1. Hi ! I want to ask once you have created your RanDisk how do you use it. Will you D&D appls there or the OS will use it automatically ??

    In Mac OS 8 and 9 I used RAMDISK but do not remember how to use now 🙁

    Thank you for some help!!


    • Hi Jorge,

      Ram Disks are essentially just a special type of volume or drive. They show up in Finder and behave like for example a USB flash drive. You can use them to temporary store any kind of data. Nowadays they are primary used to speed up disk intensive workloads where SSDs are to slow. Based on your question I’m not sure they are the right tool to solve the kind of problem you face as they have several disadvantages. This leads me to the most important question: What problem do you face?

  2. I use this script to create a 8GB ram disk every time my computer boots (user login). (Start Scripteditor and save it as a Program, Go to user Startup Items add the Program. Although it takes up to 2 minutes until the raid is created)

    Here is the script

    do shell script ”
    if ! test -e /Volumes/\”Users SpeedDisk\” ; then
    diskutil erasevolume HFS+ r1 `
    hdiutil attach -nomount ram://$((4*1024*2048))`
    diskutil erasevolume HFS+ r2 `
    hdiutil attach -nomount ram://$((4*1024*2048))`
    diskutil createRAID Stripe \”Users SpeedDisk\” HFS+ /Volumes/r1 /Volumes/r2;
    mkdir /Volumes/\”Users SpeedDisk\”/\”Download\” ;
    rm -rf ~/Library/Caches;
    mkdir /Volumes/\”Users SpeedDisk\”/\”Users Caches\”;
    ln -s /Volumes/\”Users SpeedDisk\”/\”Users Caches\” ~/Library/Caches;


    • Interesting script, thanks! Why the RAID striping though? Will it use multiple memory channels so it is even faster?

  3. […] If you prefer a GUI for this task, the original author of this tip offers one free of charge. […]

  4. sorry to be totally ignorant but how does one load a program into the ram disk e.g. safari or word or if one wants to switch between programs, in the old days with dos 6 I had a 1 meg ram drive to enable quick switching between programs

    • Hi Leon,
      Based on your question I’m pretty sure that my tool is not the correct answer to your problem. I guess you are trying to speed up your computer? If I’m correct I would suggest you to get an SSD. It will cost you between 100 and 200€/$ and your computer will feel like a new one.

      • thank you for that, i have a 2010 iMac which i just bought second hand. I have found a bit of memory for it and at the moment i can’t afford the fitting of an ssd drive. I thought i might have a play with a ramdisk but i am a gardener rather than a computer guy and can’t see how to load a program onto it so that was my question. If you like i am exploring a bit but your right in that i am trying to make things faster
        again thanks

        • A RAM disk is not really built to storage applications. Whenever you reboot everything stored in it is lost! The clear message is: Don’t store your applications on it except if you fully understand the risks associated! The right solution for your problem is a SSD.

          • when my much younger brother was studying he had a commodore 64 with which he would write his essays, when the fridge switched on to cool down it would wipe his memory banks on the 64, and he wold lose his essay. No use being afraid. However not much chance of that at the moment as no one will tell me how to put an application on a ram disk they just want to spend my money. however the rest of my memory should arrive today so i’ll have 16gb Bill gates said 640 kb should be enough for everyone, but got rich on us all wanting more smart guy bill . i not giving up though

  5. Hi Florian,
    RAMDisk Creator is great, and I used it a lot for the last few months to make saving faster. Word, Excel, PowerPoint, and GraphicConverter are particularly slow at saving files to my hard disk, and it’s much faster to use a RAM Disk. The problem is that I had to back it up regularly to disk.

    Thanks to the terminal command you showed here, I wrote an app to automatically back up files from the RAM disk to the hard disk every 5 seconds (customisable). It’s open-source, and I’d appreciate it if you could link to my website! Thank you!

    RAMDisk Accelerator is available here:


  6. could we choose a default of our own, e.g. 4 GB in a future version–or separate app as shareware with that option.

    • Hi rxflyer,
      That’s a very good idea! The application now remembers your last used settings! Should be exactly what you want! Just download version 1.3 of RAMDiskCreator.

  7. […] my post How to Create a RAM Disk – The Easy Way I released RamDiskCreator. As the name suggest it’s only duty is to create a RAM disk. The […]

  8. Thank you so much for creating that application. I need to run a recovery data software from a RAM disk and it seemed impossible to create following others posts. This app took me a sec! Thanks,

  9. […] Links: OWC Product link Link to a funny cartoon Guy’s App Pick: Auria LE, a multi-track DAW for iOS. $24.99. Gaz’s App Pick: Konvert IOS App $0.99 or £0.66 nice little conversion App also trying out Heyday a day to day journaling App. People’s Pick: From Eric Stone RamDiscCreator […]

  10. […] Links: OWC Product link Link to a funny cartoon Guy’s App Pick: Auria LE, a multi-track DAW for iOS. $24.99. Gaz’s App Pick: Konvert IOS App $0.99 or £0.66 nice little conversion App also trying out Heyday a day to day journaling App. People’s Pick: From Eric Stone RamDiscCreator […]

  11. how can I prevent Mavericks from re-creating the RAM disk after restart? It is so easy to re-create one, so it is mor annoying that the RAM disk is “stealing” my normal RAM if I don’t need one…

    Thank you for a good job done!!!

    Best regards from Denmark

  12. Hi, i use this to create the ramdisk, one question, is posible to remove the ramdisk without reboot? there are a command that removes the ramdisk from memory and let this memory free but without the need of reboot??

  13. I have done something similar before using a shell script that creates the ramdisk etc. But my main intention was to be able to move the chrome cache (located at /Library/Application Support/Google/Chrome) to the ramdisk. Using the union-flag and some scripting you could even make the cache be persistent even on reboots yet maintain the speed of the ramdisk.

    But when closing the lid, or letting my macbook go to standby the ramdisk gets unmounted and there is no stable way as far as I know to prevent this, or even to make a script run on shutdown to copy the files of the ramdisk to the original location. Any idea how this could be made possible?

    I know using a modified version of Chrome it’s possible to have no file-cache at all, only ram-cache, but this does require the cache be rebuilt every time you launch chrome.

  14. I did

    diskutil erasevolume HFS+ “RamDisk” `hdiutil attach -nomount ram://2147483648`

    and i got a 1tb ramdisk! try it out works 100% unless typed in wrong. can be used to store videos then upload to youtube via ramdisk. This is a hidden secret that Mac wont tell people about So do it Now!
    p.s. sometimes the RamDisk disappears when restarting or shuting down the mac, if it happens just do the same command and you will get it back. Hope you enjoy!

    • Hi Austin,

      Your command works however it’s not a good idea to use it!
      1.) Your command will create a RAM disk with a size of 1TB. However I’m pretty sure you don’t have 1TB of RAM. Therefore content has to be moved from fast RAM to slow disk (this is called swapping). As soon as you copy more data into the volume than RAM is available some parts of your main memory will be written to disk. This will affect the performance of your system, as important data has to be fetched from a slow spinning disk instead of the main memory! That means it is not a good idea to create a RAM disk larger than the available RAM.

      2.) Be aware, that the content of the RAM disk is permanently deleted after unmounting it! That means it can’t survive a reboot! If you only talk about the plain volume, you can create a small AppleScript to create if for you at login automatically.

      Cheers, Florian

  15. The download link above still seems to point to version 1.0…

  16. Hey Florian, a quick question. The app tells me I have 1GB RAM available, although the Activity Monitor shows much more (18GB available). Any ideas on why this might be?

    • Hi Dave,
      I sent you an eMail 🙂
      This was a bug! It’s fixed and now the free memory should be correct!

  17. And to remove it, in this instance, do hdiutil detach /Volumes/NAME (where NAME is the name you gave in the creation command). So for this example, it would be:

    hdiutil detach /Volumes/My\ 4GB\ RAM\ Disk

  18. Wouldn’t the ramdisk data length be more appropriately measured in page sizes of a “sector” rather than a page itself? Though pages can be used to denote blocks of any type of memory, it’s more connoted towards address space divisions that are variable on different paging modes. So I was slightly alarmed when heard the word pages, thinking that I’d have to go and see what my current system’s page size is.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>