-
-
Save ohshhh/5f03fbba96ec1ac0c6bf to your computer and use it in GitHub Desktop.
RamDisk Usage OSX
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 | |
# Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB | |
#DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://1572864` | |
DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://2097152` | |
/usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK | |
CACHEDIR="/Volumes/RamDiskCache/$USER" | |
# Opera Cache | |
/bin/rm -rvf ~/Library/Caches/com.operasoftware.Opera/* | |
/bin/mkdir -pv $CACHEDIR/Opera/Cache | |
/bin/mkdir -pv $CACHEDIR/Opera/Media Cache | |
/bin/ln -v -s $CACHEDIR/Opera/Cache ~/Library/Caches/com.operasoftware.Opera/Cache | |
/bin/ln -v -s $CACHEDIR/Opera/Media Cache ~/Library/Caches/com.operasoftware.Opera/Media Cache | |
# Chrome Cache | |
/bin/rm -rvf ~/Library/Caches/Google/Chrome/* | |
/bin/mkdir -pv $CACHEDIR/Google/Chrome/Default | |
/bin/ln -v -s $CACHEDIR/Google/Chrome/Default ~/Library/Caches/Google/Chrome/Default | |
# Chrome Canary Cache | |
/bin/rm -rvf ~/Library/Caches/Google/Chrome\ Canary/* | |
/bin/mkdir -pv $CACHEDIR/Google/Chrome\ Canary/Default | |
/bin/ln -v -s $CACHEDIR/Google/Chrome\ Canary/Default ~/Library/Caches/Google/Chrome\ Canary/Default | |
# Safari Cache | |
/bin/rm -rvf ~/Library/Caches/com.apple.Safari | |
/bin/mkdir -pv $CACHEDIR/Apple/Safari | |
/bin/ln -v -s $CACHEDIR/Apple/Safari ~/Library/Caches/com.apple.Safari | |
# iTunes Cache | |
/bin/rm -rvf ~/Library/Caches/com.apple.iTunes | |
/bin/mkdir -pv $CACHEDIR/Apple/iTunes | |
/bin/ln -v -s $CACHEDIR/Apple/iTunes ~/Library/Caches/com.apple.iTunes | |
# Spotify Cache | |
/bin/rm -rvf ~/Library/Caches/com.spotify.client | |
/bin/mkdir -pv $CACHEDIR/Spotify | |
/bin/ln -v -s $CACHEDIR/Spotify ~/Library/Caches/com.spotify.client | |
# Intellij Cache | |
cp -f /Applications/IntelliJ\ IDEA\ 15.app/Contents/bin/idea.properties /Applications/IntelliJ\ IDEA\ 15.app/Contents/bin/idea.properties.bkp | |
echo "idea.system.path=$CACHEDIR/Idea" >> /Applications/IntelliJ\ IDEA\ 15.app/Contents/bin/idea.properties | |
echo "idea.log.path=$CACHEDIR/Idea/logs" >> /Applications/IntelliJ\ IDEA\ 15.app/Contents/bin/idea.properties | |
/usr/bin/chflags hidden /Volumes/RamDiskCache #Hide RamDisk directory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment