Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is possible set the minimum swapfile size in OS X?

Currently OS X allocating swapfiles on demand, e.g. when when need 3.2GB will allocate 4GB and so on. But when the swap requirements start getting low the system deletes un-needed swap files. All these IO operations are very IO intensive.

Therefore looking for a way how to define the minimum swap file size, e.g. I want default allocate minimum 4GB virtual memory. When the system will need more than 4GB will allocate on demand, but at releasing will never release under 4GB size.

Is this possible somewhat? (using lion)

share|improve this question
I don't think you can do that in OSX. What Version of the OS do you have? – Martín Marconcini Jan 28 '12 at 16:35
using lion - if i remember good the latest bigger vm improve was in the snow leopard... – jm666 Jan 29 '12 at 11:36
you're correct, there hasn't been big changes in that area. You can always disable the swap and see how it goes. Some people reports having no problems whatsoever. Granted if swap is needed, the os will likely crash… – Martín Marconcini Jan 29 '12 at 16:58
From a different perspective, another question that seeks to avoid intensive operations: Mac virtual memory: how to make OS X create swap (page) files as freely with a normal boot as it does with a safe boot (swapfile1 etc) – Graham Perrin Apr 27 '13 at 9:07
To complement the comment by @MartínMarconcini: Why would I disable swap file in Mac OS X? – Graham Perrin Apr 27 '13 at 9:08

… set the minimum swapfile size …

dynamic_pager(8) Mac OS X Manual Page

With Terminal, a one-off command to convert a property list to a format that will be easily editable:

sudo plutil -convert xml1

Then if you're happy to edit with nano:

sudo nano /System/Library/LaunchDaemons/

Use option -S to set a size in bytes, then save that property list and either:

  • simply, safely, restart the Mac; or
  • unload then load the daemon – but that may be risky (and I suspect that only a restart of the Mac will reap the potential benefits).

That's a single size for all files, and any use of option -S will cause dynamic_pager to not use variable sized paging files:

  • we can not simply set a minimum – alone – amongst that set of variables.

… I want default allocate minimum 4GB …

Based on my tests with Mountain Lion, you might find that dynamic_pager will quietly fail to begin with a file that is so large.

Proceed with caution – pay attention to the actual size of swapfile0 and if it is zero bytes, then beware of inexplicable reductions to free space on the volume where the files are expected.

… at releasing will never release under 4GB size. …

Consider dynamic_pager option -L

If there are more than low-water-trigger bytes free in the external paging files, the kernel will coalese in-use pages and signal dynamic_pager to discard an external paging file. Low-water-trigger must be greater than high-water-trigger + filesize.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.