Created
October 20, 2023 18:41
-
-
Save vicendominguez/528be099c9e3ba471e653896f5c2c42c to your computer and use it in GitHub Desktop.
alias to create a ramdisk in MacOS Ventura
This file contains hidden or 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
ramdisk() { | |
if [ "$1" = "on" ]; then | |
echo creating a 100MB ramdisk: | |
size=$((2 * 1024 * 100)) | |
device_name=$(hdiutil attach -nomount ram://${size} | awk '{print $1}') | |
diskutil eraseVolume HFS+ RAMDisk ${device_name} | |
echo created: /Volumes/RAMDisk | |
elif [ "$1" = "off" ]; then | |
echo "Bye RAMDisk... sure? (control+c abort - INTRO byebye)" | |
read | |
hdiutil detach /Volumes/RAMDisk | |
else | |
echo "Uso: ramdisk [on|off]" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment