Skip to content

Instantly share code, notes, and snippets.

@vicendominguez
Created October 20, 2023 18:41
Show Gist options
  • Save vicendominguez/528be099c9e3ba471e653896f5c2c42c to your computer and use it in GitHub Desktop.
Save vicendominguez/528be099c9e3ba471e653896f5c2c42c to your computer and use it in GitHub Desktop.
alias to create a ramdisk in MacOS Ventura
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