RAM Disk Creator

After a long period of non-creative (in the sense of spitting out macros) participation in the KM forum, here is a little macro that I find useful:

RAM Disk 1.0.2.kmmacros (86.5 KB)

If you have downloaded the initially posted version, check the Edit at the end of the post, or subsequent posts, for update notes.

Macro Image

Background Actually, I thought I had made a similar macro already one decade ago. Nowhere to be found, so probably not, who knows.

There was and still is an app for this: GitHub - imothee/tmpdisk: Ram Disk Management App for OSX

I used this app some time ago, and I was pleased to see that it is still maintained. But after some runs I had to recognize that the app is somehow stuck to the era it was created in: No APFS, increment steps of the memory stepper: 16MB(!), so not a really helpful UI.

Hence the idea to make something more concise, and with a useful GUI. Maybe I will set up a PR to imothee's repo later, but for the moment this quick and dirty fast solution fits my needs.

The following text is also available in-macro via the Help button (i.e. lazily copied from there or viceversa):

RAM Disk Creator


This is the max. size of the Disk. Select from the menu, or enter your custom size. “M” is MiB, “G” is GiB.

Custom Size

The only accepted unit symbols are “m” and “g”, case-insensitive.

Examples for valid custom sizes: 275M, 275m, 670.7395m, 2.5g, 2.5G, 7G, ….

Not valid: 275, 2, 2,5g, 2.5, 2.5 g, 1,024.5m, 1073741824Bytes, 128MB, 7gb, …



Mounts a tmpfs RAM disk at a specific mountpoint. The default mountpoint is

$HOME/.tmpfs_devices/<random dir name>/<ram disk name>

The RAM disk is created with mount_tmpfs. To create a tmpfs disk, you need administrator privileges.


Mounts a RAM disk with APFS file system at the standard mountpoint (/Volumes/<ram disk name>).


Mounts a RAM disk with macOS Extended file system at the standard mountpoint (/Volumes/<ram disk name>).


The APFS and HFS+ RAM disks are the “traditional” macOS RAM disks, the tmpfs RAM disk is known from Linux systems and was introduced to the Mac only with macOS 11 (Big Sur, 2020).


According to what I’ve read, the main difference seems to be that the memory of a tmpfs RAM disk will be paged out when the memory situation becomes dire, whereas this will not happen with the “traditional” RAM disks.

So, if you create a very large RAM disk (like 80% of your total RAM), it may be better to create a tmpfs disk, to keep the system going.

On the other hand, if your purpose is that the RAM disk content never touches the HD/SSD, then the traditional (APFS/HFS+) type may be better suited.

Actual memory usage

I was unable to track the memory usage of a tmpfs RAM disk with the tools I know.

With a traditional APFS/HFS RAM disk, it seems to work like this: Initially (disk is empty), it consumes virtually nothing. Once you fill the RAM disk, memory usage grows proportionally. So far, so good, but when you remove data from the APFS/HFS RAM disk, it seems memory usage does not decrease, it will remain at the peak usage.

It is entirely possible that I just didn't wait long enough and it goes down after 10 minutes or so…, or when reclaimed by the system. If not, then this might be an additional point for the tmpfs RAM disk. But as said, I could not track the memory usage of a tmpfs disk.


I did a few tests with a folder of ~5GiB, containing a mix of bigger files and many small files (actually it was a project folder of an InDesign print project, including loads of tiny png images, and the occasional bigger files) with the RAM disks set to a max of 9GiB (on an Intel iMac 2019):

Copy the folder to the disk (Finder): tmpfs and APFS about 15% faster than HFS+

Compress the folder to an aar (LZFSE) archive (Shell script): tmpfs faster by 10–15%; the other two pretty on par.

Expand the folder (Archive Utility): tmpfs fastest, closely followed by APFS, then ~10% slower HFS+.

As said: This is the result of “a few tests” with my personal setup! Do your own benchmarks to find out the best for your setup :slight_smile:


According to my absolutely unprofessional testing (see Speed section), there is no use-case where an HFS+ RAM disk should be preferred over APFS. In regards to memory and device behavior, it behaves identical to an APFS disk, but it is just slower. I added it mainly because an HFS(+) RAM disk is the type of RAM disk that Mac users are most familiar with.

So, the meaningful choice is between “traditional” APFS RAM disk and tmpfs RAM disk. If the paging-out of the tmpfs is not an issue, I would go with tmpfs.


The default name of the RAM disk is Tmp-<size>, for example “Tmp-128M”, “Tmp-3G”. This name will be generated automatically, unless you type something in the Custom Name field.

Custom Name

The macro allows you to enter anything, but I recommend to use only characters that are allowed in file names. If you use a non-allowed character (e.g. “:”), the system will/should replace it with what it considers a good replacement.

If your custom name ends in a hyphen (“-“), the custom name will be interpreted as custom prefix, i.e. it will be prepended to the size string (<my name-><size>), e.g. “My RAM Disk-700M”.

Other Things

Number of RAM disks

You can (in theory) create as many RAM disks as you wish. They can also all have the same name.

For the “traditional” RAM disks, the system takes care of that: it renames identically named volumes automatically, but they still are displayed with their correct name in the Finder.

For the tmpfs disks, the macro will create each disk in a different, randomly named directory inside ~/.tmpfs_devices. When you create a new tmpfs RAM disk, the macro will also clean up mount points from your previous, not mounted, tmpfs disks.

Spotlight Index

The macro creates a .metadata_never_index file on the RAM disk, which should prevent Spotlight from consuming resources by indexing this volatile volume.

Sources and more Info



(This guy mounts the disk in /private/tmp, which has the advantage that the stuff there is auto cleaned periodically by the system (so no need for the auto-clean part of the script in our macro); though the downside is that the disk will not be visible in the Finder (e.g sidebar).


  • Jun 28, 2024: v1.0.2
    • Reduced the UUID for tmpfs mount directories to 6 chars, to avoid stupidly long file paths.
  • Jun 26, 2024: v1.0.1
    • Fixed a typo in the Help text.
1 Like

May I ask what you use your RAM disks for? I presume it's not just for "retro computing". :slightly_smiling_face:

You certainly have some sort of “tmp” or “temporary stuff” folder on your disk, right? (I don’t mean the one at /private/tmp, rather something in your userspace) If not, then you are probably using your Desktop or Downloads folder for temporary/intermediate things.

Well, a RAM disk is just like a “tmp” folder, but with a couple of advantages:

  • It automatically disappears when you reboot, so no disk space wasted for “temporary” stuff that for some reason tends to live for months or years in my “tmp” folder.
  • Most file operations are considerably faster: for example, expanding a 3GB LZFSE archive with lots of small files takes 23s on my SSD, and 8s on a tmpfs RAM disk. So even if we add in the copy times to and from the disk, it’s still fast.
  • By doing read/write-intensive operations on the RAM disk, you reduce the wear of your SSD (not sure if this still is an issue nowadays).
  • It is good for data that should not touch your normal drive, for example unencrypted passwords, exported from a password manager.

These are the first things that come to mind, with point #1 being the most important to me :wink:

Sure, nobody needs a RAM disk, and there are alternative solutions for some of my points (I could write a login script that cleans my “tmp” folder, I could export passwords to an encrypted sparse image, …), but I find it convenient to have a RAM disk around, or to be able to mount one quickly.

Admittedly, I lived for years without a RAM disk, but a few days ago, while cleaning up my overgrown "tmp" folder, I remembered that such a thing exists :slight_smile:

1 Like

Yes, it had been a long time since I had seen anyone refer to RAM disks, hence my curiosity. Thanks.