Skip to content

Instantly share code, notes, and snippets.

@enihsyou
Last active October 8, 2018 16:06
Show Gist options
  • Save enihsyou/95811e7d3835a74cbb6dc80cddc9a994 to your computer and use it in GitHub Desktop.
Save enihsyou/95811e7d3835a74cbb6dc80cddc9a994 to your computer and use it in GitHub Desktop.
Create a 2GB RamDisk, format with APFS, detail in Chinese 中文: https://enihsyou.com/2018/10/08/47
#!/usr/bin/env bash
SIZE=2048
DISKNAME=RAM
DISK_ID=`hdiutil attach -nomount ram://$(( ${SIZE} * 1024 * 1024 / 512 ))`
diskutil partitionDisk $DISK_ID GPT APFS "$DISKNAME" 0
# Oneline version
#diskutil partitionDisk `hdiutil attach -nomount ram://8388608` GPT APFS "RAM" 0
cd /Volumes/$DISKNAME
mkdir -p Cache/Chrome
mkdir -p Temp
@enihsyou
Copy link
Author

enihsyou commented Oct 8, 2018

You can change Chrome cache directory with this command.
defaults write com.google.Chrome DiskCacheDir /Volumes/RAM/Cache/Chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment