disable swap file

Discussion in 'MacBook Pro' started by hehe299792458, Apr 25, 2011.

  1. hehe299792458 macrumors 6502a


    Dec 13, 2008
    I'd like to disable swap files. Please, I do Not need to hear how this is not a good idea. I am aware of all the risks associated with it. I just can't seem to find more recent instructions. The latest one (http://hints.macworld.com/article.php?story=20040809191855264) is written for OS X 10.3. I can't get it to work with 10.6.7. Is there any way do to this?
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
    Cocktail claims to be able to disable swap.

    And it's a bad idea :p
  3. hehe299792458 thread starter macrumors 6502a


    Dec 13, 2008
    If I'm sure I'd never run out of memory, is it still a bad idea? I'm doing this for security reasons because I'm paranoid somebody's going to steal my passport from the pagefiles.

    Is there a way to do this without installing apps/hacks on my computer? I'd like to do it myself with Terminal or something if possible
  4. frankieboy macrumors regular

    Jun 29, 2009
    You can have OS X encrypt your swap files. Under OS X 10.6:

    Apple menu > System Preferences > Security > General tab > Checkbox for Use Secure Virtual Memory.​
  5. frankieboy, Apr 25, 2011
    Last edited: Apr 25, 2011

    frankieboy macrumors regular

    Jun 29, 2009
    And hey, if you like to live dangerously, you can take advantage of the fact the OS X won't replace a folder with a file. I don't "recommend" this and you should make a bootable clone of your system before trying it. The below will require authenticating with an Administrator password:

    1. Delete the swapfiles in private/var/vm.
    2. Create a folder on your Desktop and name it swapfile0.
    3. Move that folder into private/var/vm.
    4. Reboot.
    5. Activity Monitor verifies no page in/outs.
    6. Do Finder > Finder menu > Secure Empty Trash, since you are concerned about security of swap file contents.

    You can also take this approach to disable hibernation by installing a folder where the sleepimage is located.
  6. wonder-boy macrumors newbie


    Mar 15, 2011
    hey i'm using 10.6.7 and the use secure virtual memory is checked b default :)
  7. Fubar1977 macrumors 6502a


    Jul 30, 2010
    North Yorkshire, UK
    I know you don`t care but Frankieboy`s suggestion is much safer and just as effective.
  8. phpmaven macrumors 68040


    Jun 12, 2009
    San Clemente, CA USA
    I have no idea what you mean by "steal your passport" but why not just use drive encryption? Not that I can imagine anybody going through the trouble of trying to steal data from a swap file.
  9. hehe299792458 thread starter macrumors 6502a


    Dec 13, 2008
    lol. I meant password, but I suppose passports would theoretically be an issue as well. :D

    whole drive encryption bogs down performance, and constant decryption mades my idle speeds in the high 50C.

    frankieboy: Thanks a lot. I will try your suggestion and report back
  10. snaky69 macrumors 603

    Mar 14, 2008
    You should wear a tinfoil hat around so the gov't can't steal your thoughts too! What do you have that is password protected than anyone would want to have anyway?
  11. goMac macrumors 604

    Apr 15, 2004
    I'm not sure you can disable swap anymore...

    How much RAM do you have any way? I'd be surprised there is a MBP with enough RAM out there to fit everything in RAM. 16 gigs doesn't seem like nearly enough.

    Also, disabling VM is basically disabling the crash protection on your computer. VM is used to enforce stability.

    This is a bad bad idea. And as other posters said, you can just encrypt your swap anyway.
  12. Dalton63841 macrumors 65816


    Nov 27, 2010
    LOL What? Stuff gets swapped in and out of ram as it is needed. I have 8GB of ram, and never use more than 5.5GB. I disabled the swap file using the tutorial I pointed to above, and all is working flawlessly.

    Granted if you have less than 8GB or you do ALOT simultaneously then disabling swap is a bad idea.
  13. dal20402 macrumors 6502

    Apr 24, 2006
    This is so dumb.

    Encrypting your swap file (only), as mentioned by frankieboy, costs you nothing when you're not using the swap file.

    But it allows you to run into your RAM limit (which a poorly written Flash object could do by itself) without bringing the entire OS down hard.

    To avoid the possibility of having to use your processor to encrypt or decrypt some data, you're willing to live with the equally likely possibility of a data-destroying hard crash.

    It's a free country -- if you like living with a loaded gun pointed at your head all the time, you can. There's just absolutely no point.
  14. goMac macrumors 604

    Apr 15, 2004
    Right, but your swap file is usually at least a few times the amount you currently have in memory. The system doesn't just move stuff into swap when you run out of memory, it also moves stuff into swap when it thinks something is inactive. Swap isn't just "backup memory."

    VM is also an important part of how memory protection works. Turning it off will decrease system stability.
  15. Dalton63841 macrumors 65816


    Nov 27, 2010
    Good to know. I will keep this in mind. If I start to notice instability it is easy to revert. So far it is working just fine, but I also do not run flash. Not sure if that makes a difference. I uninstalled flash and use Chrome for the rare moments I need flash.
  16. edifyingGerbil macrumors regular

    Feb 13, 2011
    The 2.2 and 2.3GHz MBPs have decryption/encryption tools built into the processors which greatly reduce the time it takes to encrypt/decrypt so lag is not really as much an issue as it used to be.

Share This Page