Skip to content

Instantly share code, notes, and snippets.

@cykor
Created August 28, 2012 01:43
Show Gist options
  • Save cykor/3494176 to your computer and use it in GitHub Desktop.
Save cykor/3494176 to your computer and use it in GitHub Desktop.
Optimizing MacOS X Lion for SSD
#!/bin/bash
# +---------------------------------------------------------------------------+
# | |
# | A shellscript inspired by |
# | By Martin Matula <http://blog.alutam.com/> |
# | In <http://blog.alutam.com/2012/04/01/optimizing-macos-x-lion-for-ssd/> |
# | |
# | Mount the root file system / with the option noatime |
# | By Philipp Klaus <http://blog.philippklaus.de> |
# | Tip found on <http://blogs.nullvision.com/?p=275> |
# | |
# +---------------------------------------------------------------------------+
echo "Turning off local Time Machine snapshots ..."
sudo tmutil disablelocal
echo "Turning off hibernation ..."
sudo pmset -a hibernatemode 0
echo "Setting noatime flag ..."
cat << EOF | sudo tee /Library/LaunchDaemons/noatime.plist > /dev/null
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.nullvision.noatime</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
<string>-vuwo</string>
<string>noatime</string>
<string>/</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
sudo chown root:wheel /Library/LaunchDaemons/noatime.plist
echo "Verifying if noatime works ..."
mount | grep " / " /dev/disk0s2 on / (hfs, local, journaled, noatime)
echo "Setting RAM disk for temporary files [no HDD only] ..."
wget https://raw.github.com/gist/931579/1cc6a21fd594967320935c6c98289cff4cd7caf6/MoveTemporaryFoldersToRamdisk_MacOSX.sh
chmod 755 MoveTemporaryFoldersToRamdisk_MacOSX.sh
./MoveTemporaryFoldersToRamdisk_MacOSX.sh
echo "Turning off sudden motion sensor [no HDD only] ..."
sudo pmset -a sms 0
echo "Turn off hard drive sleep by going to System Preferences->Energy Saver, uncheck “Put the hard disk(s) to sleep when possible”"
echo "Use Trim Enabler: http://groths.org/trimenabler/TrimEnabler.dmg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment