Skip to content

Instantly share code, notes, and snippets.

@bassu
Last active September 25, 2023 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bassu/a57e93f1236d78c050c5db59ef6bdf31 to your computer and use it in GitHub Desktop.
Save bassu/a57e93f1236d78c050c5db59ef6bdf31 to your computer and use it in GitHub Desktop.
macOS: Chrome: RAM disk for write intensive usage
#!/bin/sh
set -eu
SIZE=3299328 # 1.5GiB i.e. 2048 = 1MB
CACHE_PREFIX="${HOME}/Library/Application Support/Google/Chrome/"
SYNC_PREFIX=${HOME}/RAM/Chrome/
rm -rf "${CACHE_PREFIX}"
mkdir -p "${CACHE_PREFIX}"
mkdir -p "${SYNC_PREFIX}"
device=$(hdiutil attach -nomount ram://${SIZE})
newfs_hfs -v "Chrome Cache" ${device}
mount -o nobrowse -o noatime -t hfs ${device} "${CACHE_PREFIX}"
rsync -aru --exclude=.fseventsd "${SYNC_PREFIX}" "${CACHE_PREFIX}"
#defaults write com.google.Chrome DiskCacheSize -int 1610612736
SHELL=/bin/bash
MAILTO=$USER
01 */3 * * * rsync -ar --del --exclude=.fseventsd "$HOME/Library/Application Support/Google/Chrome" $HOME/RAM/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment