Philipp's Computing Blog

Success is about speed and efficiency

SSD Optimizations on Mac OS X

Firefox Cache

To disable the the Firefox cache on the disk (SSD) and move it to your RAM, follow these steps:

  • Go to about:config and set browser.cache.disk.enable to false
  • as well as browser.cache.memory.enable to true.

You can check what the cache is doing by going to about:cache

Set the noatime option on the root filesystem

Attention! This is an advanced topic! Do not engage in any activity if you're not cool with the Unix command line and ready to do something to your Mac that Apple did not intend you to do! I've warned you.

You can run the following script on the terminal (don't forget to make it executable beforehand using chmod +x AlwaysMountRootFSWithNoatime_MacOSX.sh) or copy it to your Terminal line by line (not recommended):

After running this script once (you need to enter your password), reboot.

Move /private/tmp, /var/run (not /var/db) to a ram disk

After running this script once (you need to enter your password), reboot.

To check if are actually using the ram disk, run the command mount in the Terminal.app where the output should contain something like

/dev/disk2 on /private/tmp (hfs, local, union, nobrowse)
/dev/disk3 on /private/var/run (hfs, local, union, nobrowse)

You can also run hdiutil info and get an output like this:

framework       : 289
driver          : 10.6v289
images          : 4
================================================
image-path      : ram://524288
shadow-path     : <none>
icon-path       : <none>
image-type      : <unknown>
system-image    : TRUE
blockcount      : 524288
blocksize       : <unknown>
writeable       : TRUE
autodiskmount   : false
removable       : TRUE
image-encrypted : <false>
mounting user   : root
mounting mode   : <unknown>
process ID      : <in-kernel>
/dev/disk2      /private/tmp
================================================
image-path      : ram://131072
shadow-path     : <none>
icon-path       : <none>
image-type      : <unknown>
system-image    : TRUE
blockcount      : 131072
blocksize       : <unknown>
writeable       : TRUE
autodiskmount   : false
removable       : TRUE
image-encrypted : <false>
mounting user   : root
mounting mode   : <unknown>
process ID      : <in-kernel>
/dev/disk3      /private/var/run

Disable Hibernation and delete the RAM image file

Every time your Mac is sent to sleep, it could store the content of your RAM in the file /var/vm/sleepimage. To prevent this and disable hibernation, do:

sudo pmset -a hibernatemode 0
sudo rm /var/vm/sleepimage

Disable waking up when LID opens

sudo pmset -a lidwake 0

Disabling Sudden Motion Sensor (If you don't have any HDD left in your Mac)

sudo pmset -a sms 0

To check all the changes made using pmset, run:

pmset -g

Disable the swap files (virtual memory)

Paging is handled by a daemon called dynamic_pager. Turn this off with launchctl. I did not test the following, but it seems to be OK, to do it:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
# reboot:
sudo shutdown -r now

resources