Skip to content

Instantly share code, notes, and snippets.

@chaucerbao
Last active December 14, 2015 04:29
Show Gist options
  • Save chaucerbao/5028421 to your computer and use it in GitHub Desktop.
Save chaucerbao/5028421 to your computer and use it in GitHub Desktop.
(Mac OSX) Create a ram disk under /Volumes/RamDisk. Put it in `/usr/local/bin/`. Usage: ./ramdisk.sh [size(MB)]
#!/bin/sh
SIZE_MB=${1:-1024}
SECTORS=$((${SIZE_MB}*1024*1024/512))
diskutil erasevolume HFS+ "RamDisk" `hdiutil attach -nomount ram://${SECTORS}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment