Created
August 24, 2012 15:05
-
-
Save fzero/3451796 to your computer and use it in GitHub Desktop.
Create a RAM Drive in OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Halt on all errors | |
set -e | |
# Check for size parameter and display usage if needed | |
if [ "$1" == "" ]; then | |
printf "\nRamdisk - creates a RAM disk (what else?)\n\n" | |
printf "Usage: ramdisk <size in MB>\n\n" | |
exit 1 | |
fi | |
# Drive size = size in MB * block size | |
SIZE=$(expr $1 \* 2048) | |
# Do it! | |
diskutil erasevolume HFS+ "Ramdisk" `hdiutil attach -nomount ram://$SIZE` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# You can use ramdisks for all sorts of things. I personally use it to speed up Ableton Live by | |
# storing the decoding cache on it. This only works if the disk is always there, which means it needs | |
# to be re-created every time the computer boots. | |
# | |
# To do that, you'll need a second script. This is the one I use. | |
# Creates a 2Gb ramdisk | |
/path/to/ramdisk 2048 | |
# Creates the AbletonCache folder (pre-configured in the "Files" pane on Ableton Live preferences) | |
mkdir -p /Volumes/Ramdisk/AbletonCache | |
# To make it run on login, use the following command on the terminal (remember to edit the path): | |
# | |
# sudo defaults write com.apple.loginwindow LoginHook /path/to/ramdisk_login.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment