Skip to main content
X

Send us a Topic or Tip

Have a suggestion for the blog? Perhaps a topic you'd like us to write about? If so, we'd love to hear from you! Fancy yourself a writer and have a tech tip, handy computer trick, or "how to" to share? Let us know what you'd like to contribute!

Thanks for reaching out!

How to Create and Use a RAM Disk with Your Mac (Warnings Included!)

Once a popular option in the early days of the Mac, RAM disks, which were used to speed up the performance of a Mac, have fallen by the wayside.

Conceptually, RAM disks are a simple idea: a chunk of RAM set aside that looks, to the Mac system, like just another storage drive. The system, as well as any installed apps, can write files to or read files from the RAM disk, just as if it really were another storage drive mounted on your Mac.

But unlike any storage drive, a RAM disk can operate at the speed of RAM, which is usually many times faster than most drive storage systems.

RAM Disk History
RAM disks existed before the Macintosh ever hit the market, but we’re going to predominantly explore how RAM disks were used with the Mac.

The Mac Plus, released in 1986, had quite a few new features, including the use of SIM (Single Inline Memory) modules that users could easily upgrade. The Mac Plus shipped with 1 MB of RAM, but users could increase the memory size to 4 MB. That was an amazing amount of RAM in 1986, and begged the question: What can I do with all this memory space?

At the same time, many users were asking how they could speed up their Macs. And while many users were happy to just max out the RAM, and enjoy the performance gain of having more memory, which let them run more applications concurrently, some users discovered the joys of using a RAM disk to speed up the system and apps. Other users discovered that a RAM disk could be used to create an amazingly fast storage system. Remember, back then, most Mac Plus users were getting by with a single 800 KB floppy drive, while those who felt like splurging could add an additional external floppy drive. If you really had cash to burn, you could hook up a 20MB SCSI (Small Computer System Interface) hard drive, which would likely set you back well over $1,200.

The first prominent use of a RAM disk was to copy the Mac’s slow ROM (Read Only Memory), which contained many of the system’s core components, along with the operating system, which was stored on a floppy drive, and move them both to a RAM disk where they could operate at the speed of RAM; many, many times faster than either the floppy disk or the ROM.

The performance increase was amazing, and was achieved for just the cost of a RAM disk utility app.

The second common use of a RAM disk back in the Mac Plus days was to create a tiered storage system. Floppy drives weren’t fast enough for professionals or avid amateurs to work with new rich media editing systems, such as audio editors, image editors, or page layout apps. SCSI drives could meet the needs of image editing and page layout, but audio editing was at best iffy, with most SCSI drives being too slow to provide the needed bandwidth for audio or other real-time editing.

RAM disks, on the other hand, were very fast, and could easily meet the needs of real-time editing with their ability to write or read files as quickly as the RAM could be accessed, without the mechanical latency inherent in SCSI or floppy disks.

Speed test
(RAM disks can be very fast. In my case, over 10x faster than my Mac’s startup drive.)

The only disadvantage to RAM disks was that the data stored in them was lost every time you turned your Mac off, or the power went out. You had to remember to copy the content of the RAM disk to your main storage system or your work would be lost.

Modern Uses for RAM Disks
RAM disks are likely to be the fastest storage location available on a Mac, easily outperforming any hard drive, and in most cases, beating out SSDs. If you can live with the downside of RAM disks, primarily their small sizes, and the issue of not being able to retain data when power to your Mac is turned off, then there are still plenty of good uses for them.

  • Scratch space and temp files: Assigning RAM disk space for use with a multimedia app as scratch space can increase the app’s performance. This assumes the app in question prefers to use disk space for its temporary files.
  • Games: Try loading your favorite game, or for small RAM disks, just the saved game files to a RAM disk. You should see faster load times and rendering speeds, and smoother play.
  • Video or audio editing/rendering: Load textures, images, audio loops, or other media assets you’ll be using onto a RAM disk for better overall performance.
  • Compression: If you need to compress a large number of files as part of your workflow, moving them to a RAM disk can speed up the compression time.
  • Batch file processing: If you’re converting a number of image, audio, or video files from one format to another, moving the files to your RAM disk can increase performance.

Creating a RAM Disk
There are two ways to create a RAM disk; you can use the Terminal app to manually create a RAM disk, or you can make use of a third-party utility for creating a RAM disk.

Activity Monitor
(You can use Activity Monitor to get a handle on how much free RAM you have available.)

It’s a good idea to start the process of creating a RAM disk by knowing how much free RAM space you have available to work with:

Launch Activity Monitor, located at /Applications/Utilities/.

Select the Memory button in the Activity Monitor window.

At the bottom of the window is a summary of how the RAM is being used. You should see entries for Physical Memory, and Memory Used. Subtract Memory Used from Physical Memory to figure out how much free memory is available to you.

It’s a good idea not to use all of the free memory; your Mac always needs some free memory to work with. Apps like web browsers can quickly swallow up free memory, not to mention the RAM disk you’re about to create. I suggest you leave the Activity Monitor app open, so you can see how memory is being used on your Mac as you experiment with creating and using RAM disks.

Note: The RAM disk you create will not affect the Memory Used entry until you actually use the RAM disk to store data.

Let’s start with using the included Terminal app:

Launch Terminal, located at /Applications/Utilities/.

The following command will create the RAM disk:

diskutil erasevolume HFS+ "RAMDisk" `hdiutil attach -nomount ram://2048`

The command has a number of parameters you’ll likely wish to change; the first is the name of the RAM disk, which in the example is “RAMDisk”. You can use any name you wish; just be sure the name is contained within the double-quotes.

Terminal can create a RAM disk and mount it on the desktop
(Terminal can create a RAM disk and mount it on the desktop, ready to use.)

The second option you may wish to change is the size of the RAM disk; in this example, the entry ram://2048 will create a 1 MB RAM disk. The size you enter is how many memory blocks to use in the RAM disk; 2048 blocks will create a 1 MB RAM disk. Multiply the 2048 value by the number of MB you wish to use for the RAM disk; some examples:

  • 256 MB = 524288
  • 512 MB = 1048576
  • 1 GB = 2097152
  • 2 GB = 4194304

The last note about the command is the accent grave ` character used before hdiutil and after the size parameter. The character is not a single quote; the accent grave character is found at the top left of most QWERTY keyboards; the accent grave character is usually on the same key as the tilde (~) character.

With all the notes taken into account, if you wished to create a 1 GB RAM disk, you would enter the following at the Terminal prompt:

diskutil erasevolume HFS+ "RAMDisk" `hdiutil attach -nomount ram://2097152`

and then press enter or return.

After a moment or two, the RAM disk will be mounted on your Mac’s desktop, ready for you to work with.

Third-Party RAM Disk Utilities
There are a number of utilities that make creating and managing a RAM disk a bit easier than using Terminal.

  • TmpDisk: Available at github.com/imothee/tmpdisk, TmpDisk is a simple Open Source RAM disk management app. It allows you to create RAM disks by simply filling in a few fields. It installs as a menu bar item and includes the ability to create RAM disks automatically at startup.
  • Ultra RAM Disk: Available from the Mac App Store, Ultra RAM Disk installs as a menu bar item that allows you to create RAM disks when needed.
  • RAMDisk: Available from the Mac App Store, 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.
TmpDisk
(Using a third-party utility, such as TmpDisk, can be a bit easier than remembering Terminal commands.)

Using the RAM Disk
Now that you have a RAM disk mounted on your Mac you can use it just as if it were another drive. Try copying an image file to the RAM disk and then open it in your favorite editor. You may be amazed at how fast it opens, as well as how fast you can perform edits and save the image.

If you have a favorite game, and enough free memory to house the game, try using the RAM disk to run the game from. You may be racking up points faster than ever.

Remember: The key to using a RAM disk is that the information stored within it is volatile. It won’t survive a shutdown or power loss. Make sure you copy any information you need from the RAM disk before shutting down.

Tom Nelson
the authorTom Nelson
Writer
Tom has been an enthusiastic Mac user since the Mac Plus. He’s also been known to dabble in the dark side, otherwise known as Windows, and has a well-deserved reputation for being able to explain almost anything to anybody. Tom’s background includes more than 30 years as an engineer, programmer, network manager, software tester, software reviewer, database designer, and computer network and systems designer. His online experience includes working as a sysop, forum leader, writer, and software library manager.
Be Sociable, Share This Post!

Leave a Reply

20 Comments

  • I want to use the Ram for an animation program, how to i direct the app to use the extra Ram? thanks

  • Helpful article! The ` backquote mark seems to have gotten dropped form the article source at some point:

    diskutil erasevolume HFS+ “RAMDisk”hdiutil attach -nomount ram://2048

    It would be good to get that added back in because it’s confusing without it and I wouldn’t have thought to dig into the terminal screenshot to see this detail without the discussion of it in the text (“what ` backquote?” thought led me to look further).

    • hey you have to use like this diskutil erasevolume HFS+ “RAMDisk” hdiutil attach -nomount ram://2048

      see before hdiutil an after 2048

  • It seems RAMDisk does not work with High Sierra (macOS 10.13) and above and Ultra RAM Disk is not available in the Canada store.

  • Another advantage in today’s age of SSDs is preserving SSDs limited R/W cycles. So using for anything that needs lots of write cycles is probably a good idea. One such use case would be browser cache files.

  • On El Capitan (OS X 10.11) and higher, omit the quotation marks around the RAM disk name—RAMdisk, not “RAMdisk” in the example above—unless you want the drive name to include them.

  • All of the App Store Apps get bad reviews. It looks like github or terminal may be the only reliable options.

    @Vito: I think he knew what he meant. Language is fluid, and a phrase doesn’t have to be restricted to an idiom or singular meaning.

  • I remembered using it frequently on my Motorola Starmax 4000, with 144 Mo of RAM. It was huge at this era. I took 64 Mo for a RAM disk and copy the 7.5.5 system. Much faster boots ! And you can reboot without loosing RAM content !

    But at this time I had 144 Mo of RAM for 20 Go of hard drive. The system was small, 10 to 40 Mo …

    Today you have 16 Go of RAM for 1 or 2 To of hard drive/SSD, not the same ratio, and macOS take 4 to 8 Go, so you need more RAM, and many Macs are limited to 16 Go.

    Thanks for the tips !

  • “…and begged the question: What can I do with all this memory space?”

    I think you mean “raised the question”. “Begging the question” is an idiom that means to assume the truth of the point raised in a question — a logical fallacy.

    There is nothing illogical in asking a question about how to utilize an abundance of RAM.

  • amazing this is still around although I wonder how much speed increase there is compared with a modern pci-e connected ssd. I remember having one of those 20 MB hard drives, it had exactly the same footprint as the MacPlus so it sat underneath the mac. It took about 20 seconds to spin up let alone read any data….

  • I’ve always wondered why RAMdisks went away. I loved having a ripping fast scratch disk. Glad to know I can still do this. Now I need to upgrade my RAM, but I want a new Mac first.

  • Terrific article. I think it might work well with Corel Painter files. Corel is a heavy user of ram. Has anyone else tried this with Corel Painter files?

  • This article on RAMDisk was very useful. I expect RAMDisk will improve the I/O performance of my older i-Mac running under OS 10.6.8 — Necessary because all of my manuscripts are written in the obsoete AppleWorks 6.2. I am going to give it a try.

  • the command
    diskutil erasevolume HFS+ “RAMDisk” `hdiutil attach -nomount ram://2048′

    doesn’t work, as the last character isn’t the right character. You need to use

    diskutil erasevolume HFS+ “RAMDisk” `hdiutil attach -nomount ram://2048`

  • > only disadvantage to RAM disks …

    I think that is one of their advantages. Think of it as self cleaning scratch space.

    • Good article… I used to use RAM Disks all the time pre-OS X. Makes a lot of sense for running files in photoshop and a browser, but I am really interested in whether I could run Davinci Resolve in a RAM Disk with local cache files.
      I already I maxed out my Macbook Pro with an SSD and 16GB RAM from Macsales.com . In this context, I am wondering about how to best partition unused RAM with my current config:

      – 16 GB RAM, 6Gbps boot SSD 450MBps read/write
      – OS X Sierra and Davinci Resolve 15 combined, consume only 8GB of RAM
      – leaving up to 8 GB free for a RAM Disk/Cache…
      – Of the 8GB unused, lets say for system stability/safety I make a 4 GB RAM disk (leaving 4GB RAM unused).
      – The Davinci Resolve app itself takes 1.5 GB in the applications folder after install

      If I understand the above correctly, could I install the app on the RAM disk and have it cache up to 2 GB of temp files? – The speed test comparison above shows it to be almost 10x the I/O of the SSD!

      Could this work? Is my logic correct here?

      JL