When my MacBookPro5,2 with 8 GB memory boots in safe mode I see that the operating system causes dynamic_pager(8) to create swap files in a way that's relatively unrestrained. In the file system that I dedicate to swap, siblings of


are created very quickly. Simple use of an app seems to result in more swap files than comparable use of that app with a normal boot.

Performance with safe boot – with a greater than normal mass of external swap files – is remarkably good. So I'd like to experiment with:

  • an equally unrestrained approach to swap files with a normal boot.


How can I make the operating system behave in a way that causes a greater than normal mass of swapfiles to be created by dynamic_pager?

I'm prepared to accept the risks that may be associated with evil tuning.


Why might more memory be wired in safe mode than in normal mode?

Answers there may help towards answers here.

Preliminary investigation

I ran sysctl -a in normal mode and safe mode. I see differences but (unless I'm missing something) nothing to explain the freedom that's associated with a safe boot.

https://apple.stackexchange.com/a/72732/8546 by @Quantumpanda is thought-provoking but the question there is, in a way, the opposite of what I want.

In Server Fault, FreeBSD performance tuning. Sysctls, loader.conf, kernel is popular but much of that seems network-oriented.

First experiments

The essence of this question was originally:

  • How can I get dynamic_pager to behave with a normal boot as it behaves with a safe boot?

– and so I experimented with values for -S and -H.

dynamic_pager option -S

In 2003, when -H and -L were hire_point and layoff_point, the default file_size was 20000000 Mac OS X in a nutshell, page 595). For more recent versions of the operating system, some users prefer a filesize that's around fifty times greater, 1.07 GB on disk:

  • 1073741824

dynamic_pager option -H

With and without a value for -S, I experimented with various high-water-trigger values, including the one suggested by dynamicpagerwrapper:

  • 209715200

None had the required effect.


Addressing The Outmoded Swapping And Paging Strategy in OSX? | dropsafe (2010-03-01, updated in 2012)

dynamic_pager_wrapper source from dynamicpagerwrapper – performance wrapper for /sbin/dynamic_pager on OSX

In the Mac Developer Library:

1 Answer 1


AFAIK the reason all those swap files were created so quickly in Safe Mode is because dynamic_pager fell back to an initial swap size of 64MB. How many swap files did you see? How many do you want to see? How many are you seeing?

Right now on my Mac Pro (desktop) running OS 10.8.3 I have 7 swap files (numbered 0-6). Is that what you want? Actually, since you've pointed this out, I'm going to try to reduce that to 2.

If you really want to create a lot of swap files, just set -S 67108864

BTW, 1073741824 = 2^30 = 1 GiB


Turns out there is a bug in dynamic_pager (at least under Mountain Lion 10.8.4) where setting -S 2147483648 (= 2 GiB) fails because of some sort of 32-bit conversion error.

Cannot extend paging file size /private/var/vm/swapfile0 to 18446744071562067968!

2147483648 as a 32 bit signed in is actually -2147483648 or 0x80000000 which gets extended to a 64 bit number by extending the MSB and turned into 0xFFFFFFFF80000000 which is then converted to a 64 bit unsigned which is 18446744071562067968 or 2 GiB * 8 GiB. Crazy. So after you mess with the dynamic pager options, look for error messages in the console logs.

  • Not simply the number of files. Think of the mass – the sum of the sizes of all swap files. What causes the operating system to create that greater mass? Apr 29, 2013 at 17:35
  • 1
    Never heard that called 'mass' before. What causes OS to create more total swap space is more total active memory use, i.e. more need to swap data in and out of memory. It's a bad thing, but if you want to do it you can write a simple C program using mmap and MAP_ANON to eat up all the real memory, forcing everything else into swap.
    – Old Pro
    Apr 29, 2013 at 18:46

You must log in to answer this question.

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