Last active
June 7, 2016 16:59
-
-
Save Tolsi/c1cf0d8958d113740dcff78b387e958c to your computer and use it in GitHub Desktop.
Bash functions for create/mount and umount RAM partitions for Mac OS X 10.11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pass size in mb and optional name | |
function ram_disk_mb() { | |
name=${2:-disk} | |
diskutil erasevolume HFS+ "ram_$name" $(hdiutil attach -nomount ram://$(($1*2048))) | |
} | |
# pass size in gb and optional name | |
function ram_disk_gb() { | |
ram_disk_mb $(($1*1024)) | |
} | |
# unmount partition with given name or all partitions with the default name | |
function umount_ram_disks() { | |
umount /Volumes/ram_* | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment