Skip to content

Instantly share code, notes, and snippets.

@artyom
Last active March 14, 2016 17:20
Show Gist options
  • Select an option

  • Save artyom/78f03cf9f529eae017f5 to your computer and use it in GitHub Desktop.

Select an option

Save artyom/78f03cf9f529eae017f5 to your computer and use it in GitHub Desktop.
Create ramdisk on OS X (run as root), eject disk in GUI to remove
#!/bin/sh -eu
NUMSECTORS=$(($1*1024*1024/512))
MYDEV=$(hdiutil attach -nomount ram://$NUMSECTORS)
diskutil eraseVolume HFS+ "ramdisk-${1}mb" $MYDEV
@artyom

artyom commented Mar 14, 2016

Copy link
Copy Markdown
Author

Run specifying disk size in megabytes as first argument.

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