Be Genius

me

Bo Jeanes

I am an Australian full-stack developer living and working in San Francisco. I strongly advocate open-source software and the community around it. I am a tool maker. I currently work primarily in Ruby and Rails but do as much Clojure, Go, and Javascript as I can.

Fix for "dynamic_pager: cannot open swap directory /private/var/vm" in OS X (possibly just Snow Leopard)

Today my Snow Leopard install was going so slow it felt like I was trying to swim through molasses. The system was literally so slow that typing text into some text fields (especially TextMate) lagged at about a rate of 1 character per second, and opening files (or even running touch on them) took a couple of seconds.

After a few fruitless restarts and a keen eye on my logs I started noticing these errors in Console.app:

9/07/09 3:01:37 PM com.apple.launchd[1] (com.apple.dynamic*pager) Exited
with exit code: 1\
9/07/09 3:01:37 PM com.apple.launchd Throttling respawn: Will start in
10 seconds\
9/07/09 3:01:47 PM com.apple.dynamic*pager[2481] dynamic*pager: cannot
open swap directory /private/var/vm\
9/07/09 3:01:47 PM com.apple.launchd Exited with exit code: 1\
9/07/09 3:01:47 PM com.apple.launchd Throttling respawn: Will start in
10 seconds\
9/07/09 3:01:57 PM com.apple.dynamic*pager[2546] dynamic*pager: cannot
open swap directory /private/var/vm\
9/07/09 3:01:57 PM com.apple.launchd Exited with exit code: 1\
9/07/09 3:01:57 PM com.apple.launchd Throttling respawn: Will start in
10 seconds\
9/07/09 3:02:07 PM com.apple.dynamic*pager[2547] dynamic\_pager: cannot
open swap directory /private/var/vm\
9/07/09 3:02:07 PM com.apple.launchd[1] (com.apple.dynamic\_pager[2547])
Exited with exit code: 1\
9/07/09 3:02:07 PM com.apple.launchd[1] (com.apple.dynamic\_pager)
Throttling respawn: Will start in 10 seconds\

I don’t know how or why they started but I was able to fix it by simply running sudo mkdir /private/var/vm in Terminal. Within a few seconds of creating the directory, the errors ceased and I could see a swapfile created inside the directory.

I have no idea what caused the directory to be deleted in the first place or why OS X isn’t smart enough to try creating it, but the fix is simple and instantly effective.

Note: I am not sure if this is a Snow Leopard specific issue or not, but it very well might be. Also, these started right after installing Adobe CS4, so I feel pretty confident blaming that for now.

Comments

  1. 2/1/13 3:52:48.000 PM kernel[0]: macx_swapon SUCCESS

    you're my hero!

    by haraldox on
  2. +1

    by Fredrik Wollsén on
  3. Thanks! Works in Mavericks 10.9.2.

    by Anton Sokolchenko on

You need to login with GitHub in order to comment.