Skip to content

Instantly share code, notes, and snippets.

@dnozay
Created September 11, 2013 18:22
Show Gist options
  • Save dnozay/6527648 to your computer and use it in GitHub Desktop.
Save dnozay/6527648 to your computer and use it in GitHub Desktop.
create a ramdisk on OSX.
# you can add this to your ~/.bash_profile
# based on: http://www.tekrevue.com/tip/how-to-create-a-4gbs-ram-disk-in-mac-os-x/
create_ramdisk() {
# usage: create_ramdisk ramdisk_name size_in_kb
# e.g. "create_ramdisk ramdisk 4096" will create a 4GB ramdisk.
let ramsize=$2*2048;
diskutil erasevolume HFS+ $1 `hdiutil attach -nomount ram://$ramsize`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment