Skip to content

Instantly share code, notes, and snippets.

@atr000
Created July 16, 2009 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atr000/148269 to your computer and use it in GitHub Desktop.
Save atr000/148269 to your computer and use it in GitHub Desktop.
# Steps, with commands, to move the swap file on MacOS X/10.5 (Leopard)
# Handy for us with very small drives like the 8GB SSD in Mini9s
# First, find the name of your "volume" -- it depends on what you named upon formatting but can be changed via the Finder without issue.
# get this name static since I am not sure if/howto utilize a udev/UUID mounting scheme on OSX, given its major differences.
# From seeing how to mount a drive prior to a user login (handy if you do have extra space and require this to be mounted upon boot so everything does not crash), an answer could be in the autofs stuff but this works.
# standard mkdir in terminal. use a dot dir so its "hidden" normally since seeing a swapfile in the finder is pointless
mkdir /Volumes/FlashMedia/.vm
# then find: /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
# You want to edit the key for -F
# stock (as of 10.5.6) looks like:
# <string>/sbin/dynamic_pager</string>
# <string>-F</string>
# <string>/private/var/vm/swapfile</string>
# use vi, your favorite texteditor, or one of the plist editors.
# If you're in vi/vim, here's the mighty sed in action (assuming FlashMedia is your diskname and you made the directory .vm in its root):
# :%s/\/private\/var\/vm\/swapfile/\/Volumes\/FlashMedia\/\.vm\/swapfile/
# My sed is rusty and I'm used to doing this inside vim, so I'm sure a ninja could translate this into a direct cli option in a few seconds.
#
# next: suggested you reboot, but not certain if your computer will break if its not done fairly soon, so do it anyways to be safe.
# once it comes back up, rm the contents of /private/var/vm/swapfile
#
# what is on my desktop, for reference, in that dir:
# -rw------T 1 root wheel 67108864 2009-07-16 00:44 swapfile0
# -rw------T 1 root wheel 67108864 2009-07-16 01:05 swapfile1
I then edited /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist to have the -F parameter point at that path instead of the default /private/var/vm/swapfile, rebooted, and removed the old files from /var/vm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment