The Need for Extreme Speed
Modern Mac hardware, particularly the Apple Silicon (M-series) chips, feature incredibly fast unified memory (RAM) and highly optimized internal SSDs. However, even the fastest NVMe SSD is exponentially slower than the system’s RAM.
If you are performing tasks that require massive, sustained disk read/write cycles—such as rendering 4K video, compiling a massive codebase (like the Chromium browser or a complex iOS app), or processing gigabytes of temporary scratch data in Photoshop—the physical SSD becomes the bottleneck. Furthermore, constantly writing and deleting hundreds of gigabytes of temporary data puts unnecessary wear on your SSD’s flash memory cells.
The solution is to create a RAM Disk. This allocates a specific chunk of your system’s RAM and tells macOS to format it and treat it as a physical hard drive. It appears on your desktop like a USB drive, but read and write speeds are virtually instantaneous. Because RAM is volatile, the moment you eject the drive or restart the Mac, all the data on it is permanently and instantly destroyed.
Step 1: Calculating the Size
macOS allocates RAM disks based on standard 512-byte blocks. To create a disk of a specific size, you must perform a simple calculation:
(Desired Size in Megabytes) * 2048 = Block Size
For example, if you want to create a 4 GB RAM disk (which is 4096 MB):
4096 * 2048 = 8388608
(Warning: Do not allocate more RAM than you have available, or macOS will aggressively use disk swap, completely defeating the purpose of the RAM disk and freezing your computer).
Step 2: Creating the Virtual Device
Open the Terminal application (found in Applications > Utilities).
We use the hdiutil (Hard Disk Image Utility) command to carve out the block of RAM and attach it as an unformatted block device.
Type the following command, replacing the number at the end with your calculated block size from Step 1:
hdiutil attach -nomount ram://8388608
When you press Enter, the terminal will return the name of the new virtual device. It will look something like this:
/dev/disk4
Note this disk identifier (e.g., disk4). You will need it for the next step.
Step 3: Formatting the RAM Disk
The RAM has been allocated, but macOS cannot use it until it has a file system. We will format it as Apple File System (APFS) or Mac OS Extended (HFS+). For temporary scratch disks, HFS+ is perfectly fine and often slightly faster.
In the terminal, run the diskutil command to format the device you just created (replace disk4 with your actual identifier, and “ScratchDisk” with whatever you want to name it):
diskutil erasevolume HFS+ "ScratchDisk" /dev/disk4
The terminal will display a progress bar. Once it finishes, look at your desktop. A new drive icon named “ScratchDisk” will have appeared.
Step 4: Using and Destroying the Disk
You can now open your video editor or compiler and point the “scratch” or “output” directory directly to the RAM disk. The processing speed will be astounding.
Because RAM is volatile, none of the data is saved permanently. If you generate a final exported video file that you want to keep, you must drag it off the RAM disk and onto your actual Mac hard drive.
When you are finished with your intensive tasks, simply right-click the RAM disk on your desktop and select Eject “ScratchDisk”.
The drive will vanish, the data is instantly destroyed, and the 4GB of RAM is immediately returned to macOS for normal system use.