Disable compressed memory in Mac OS 10.9 Mavericks?

28

21

Is there any way to disable memory compression in Mavericks? Ever since I upgraded, my Minecraft server has been using ludicrous amounts of CPU time and choking. I'd like to test without compressed memory to see if that might be the culprit.

Thom Smith

Posted 2013-10-31T23:29:28.637

Reputation: 617

2

This should be posted in http://apple.stackexchange.com/

– Charlie – 2013-12-11T23:42:38.570

2@Charlie no it should not. It can be since it would be on topic there but it can also stay since it is perfectly on topic here as well. Please don't tell people to move perfectly valid questions. – terdon – 2013-12-12T05:36:15.337

1I didn't tell anyone to do anything; and this should be posted in the apple stack exchange because it is a strict subset of superuser but specific to mac/apple. Superuser is the catchall for topics that don't fit anywhere else. – Charlie – 2013-12-12T17:06:46.747

1Why did Community protect this question? What answers were deleted? – gparyani – 2013-12-24T04:50:04.613

1

For disabling compressed memory, the accepted answer here is ideal – thanks. In Ask Different: vm_compressor_mode (vm.compressor_mode) values for enabled compressed memory in OS X

– Graham Perrin – 2014-01-27T07:12:11.110

Answers

32

vm/vm_pageout.h defines the modes for the vm_compressor boot argument, which defaults to VM_PAGER_COMPRESSOR_WITH_SWAP (per vm/vm_compressor.c). For OS X 10.9, 10.10, and 10.11, you can disable compression by changing the vm_compressor_mode argument to 1 (VM_PAGER_DEFAULT). That is:

sudo nvram boot-args="vm_compressor=1"

Then reboot. You can verify the change was successful by running:

sysctl -a vm.compressor_mode

Starting with macOS 10.12 Sierra, the old VM_PAGER_DEFAULT is no longer supported and vm_compressor=1 is converted to vm_compressor=4 inside the kernel.

Michael Galati

Posted 2013-10-31T23:29:28.637

Reputation: 436

1I'd assume that sudo nvram -d boot-args would also revert it to its default. – Feuermurmel – 2015-04-26T11:12:52.723

1FYI: I had disabled compression in Mavericks, as described here, when it seemed to be interacting poorly with a large-RAM VMWare Fusion guest. After upgrading to Yosemite (10.10.4), I was getting crashes every 10-15 minutes under light web browsing. (Specifically: 1st a mouse freeze, then a reboot about a minute later, attributed in the post-reboot crash report as a "progress watchdog" event.) On a hunch, I reverted to "vm_compressor=4" – and haven't had a Yosemite crash since. – gojomo – 2015-08-06T02:20:22.423

Any idea how to re-enable compression when the Mac crashes on shutdown (or so it claims) and fails to save the nvram setting? – Radu C – 2015-10-24T23:18:02.303

2I found a way: it doesn't crash if I shut down after logging out, so that worked out for saving the nvram setting – Radu C – 2015-10-25T16:18:28.997

Thankyou @RaduC! I had the same problem - changed to no compression, was trying to apply Yosemite minor update 10.11.2 and it would crash on shutdown. Logging out first made it possible to shutdown properly. – nevster – 2015-12-14T13:17:39.387

Note this no longer works on sierra: nvram: Error setting variable - 'boot-args': (iokit/common) general error – user3544438 – 2016-11-22T13:38:43.463

for sierra, disable system integrity protection first, it worked OK for me on sierra thusly – rogerdpack – 2016-12-22T20:02:09.467

5Note that, to get it back you can use: sudo nvram boot-args="vm_compressor=4" – James Antill – 2014-04-25T01:29:44.440