Skip to content

Instantly share code, notes, and snippets.

@marugoshi
Created October 7, 2011 19:52
Show Gist options
  • Save marugoshi/1271211 to your computer and use it in GitHub Desktop.
Save marugoshi/1271211 to your computer and use it in GitHub Desktop.
To Save MacBookAir SSD
#!/bin/sh
SIZE=262144
MOUNT_POINT=/Volumes/ramdisk
RAM_DISK=`hdid -nomount ram://$SIZE`
newfs_hfs -v ramdisk $RAM_DISK
mkdir -p $MOUNT_POINT
mount -t hfs $RAM_DISK $MOUNT_POINT
chmod 0777 $MOUNT_POINT
CHROME_CACHE_DIR=/Users/tokuyama/Library/Caches/Google/Chrome/Default/Cache
rm -rf $CHROME_CACHE_DIR
ln -s $MOUNT_POINT $CHROME_CACHE_DIR
APACHE_LOG_DIR=/private/var/log/apache2
rm -rf $APACHE_LOG_DIR
ln -s $MOUNT_POINT $APACHE_LOG_DIR
# place this file into directory like /usr/local/bin
# then execute command like below
# sudo defaults write com.apple.loginwindow LoginHook /usr/local/bin/ramdisk.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment