I'm trying to mount a RAM disk on startup with this:


diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://800000`


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
<plist version="1.0">

And then running:

  • sudo chown root:wheel /Library/LaunchDaemons/com.aram.ramdisk.plist
  • sudo launchctl load -w /Library/LaunchDaemons/com.aram.ramdisk.plist

But I get these in the console:

1/08/12 1:29:25.982 PM fseventsd[64]: could not open <</Volumes/RamDisk/.fseventsd/fseventsd-uuid>> (No such file or directory)
1/08/12 1:29:25.982 PM fseventsd[64]: log dir: /Volumes/RamDisk/.fseventsd getting new uuid: 102D7293-F1F1-4640-AA50-D547C365339F

1/08/12 1:29:24.561 PM sudo[1193]:     Aram : TTY=ttys000 ; PWD=/Library/LaunchDaemons ; USER=root ; COMMAND=/bin/launchctl load -w /Library/LaunchDaemons/com.aram.ramdisk.plist

1/08/12 1:40:17.052 PM com.apple.launchd[1]: (com.aram.ramdisk) Throttling respawn: Will start in 8 seconds

It works if I set KeepAlive to true, but then it creates a RAM disk every 10 seconds.

Is there a way to delay the script for 10 seconds before running?

  • Which version of OSX are you using?
    – de_an777
    Aug 1, 2012 at 5:24
  • Mountain Lion... Aug 1, 2012 at 13:33

2 Answers 2


You can delay the execution of the diskutil command in your ramdisk.sh script by prepending the line sleep 10.

Sleep suspend the execution for an interval of time, in seconds.

Your new ramdisk.sh becomes:

sleep 10
diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://800000`

Update#1: launching the ramdisk.sh every 10 seconds and only creating the RAM disk when it is not there, is a workaround. See this example script for such a conditional check:

sleep 10
if [ ! -e "/Volumes/$RD" ];  then
    diskutil erasevolume HFS+ "$RD" `hdiutil attach -nomount ram://800000`

Your error might be caused because /Volumes is not already created in the boot process at the moment your launchd job is executed. Thefore you could first check for the existence of /Volumes before even further executing the script, like:

if [ -e "/Volumes" ];  then
    if [ ! -e "/Volumes/$RD" ];  then
        diskutil erasevolume HFS+ "$RD" `hdiutil attach -nomount ram://800000`

And when the creation succeeds you might want to unload your com.aram.ramdisk.plist from launchctl until the next boot.

  • 2
    This might be a good use for the QueueDirectories keyword in the launchd configuration (to make sure /Volumes is available)
    – nohillside
    Aug 1, 2012 at 8:21
  • I am having the same issue with my RAM disk creation script. And the same problem, it only works when I you add sleep 10 at the start. I'd like to figure out exactly why the sleep is needed. I tried checking for /Volumes but it's there from the start, so it must be something else.
    – l008com
    Mar 10, 2018 at 10:58

Using Pro Backup's great answer I put this together and it works:

while [ ! -d /Volumes ]
    echo "waiting..."
    sleep 2
if [ ! -d /Volumes/$NAME ]; then
    echo "creating ramdisk..."
    diskutil erasevolume HFS+ $NAME `hdiutil attach -nomount ram://800000`

I needed this so that my browser wouldn't cache to my SSD, so I deleted this:

rm -rf /Users/Aram/Library/Caches/Google/Chrome/Default

And created a symlink:

ln -s /Volumes/RamDisk/ /Users/Aram/Library/Caches/Google/Chrome/Default


I just added the script as a startup application in user settings on my mac, always works, though leaves a terminal open. No big deal for me.

  • Why wouldn't you want your browser to cache to SSD? For more space?
    – Shane Hsu
    Apr 14, 2013 at 5:28
  • 2
    Mostly to reduce tiny writes every time the cache changes. I need the cache to speed up browsing, and I use the computer all day, so having it in the RAM doesn't have any impact other than reducing usage of the disk. Chances are the life expectancy difference won't affect me, but over many years there may be a difference. Apr 14, 2013 at 5:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .