Skip to content

Instantly share code, notes, and snippets.

@ivanrad
Created October 8, 2015 15:05
Show Gist options
  • Save ivanrad/abb4b00f9d8845245a5f to your computer and use it in GitHub Desktop.
Save ivanrad/abb4b00f9d8845245a5f to your computer and use it in GitHub Desktop.
maketmpfs (OS X)
#!/bin/bash
set -e
tmpfs_size=1024
tmpfs_target=$HOME/tmpfs
tmpfs_size_sectors=$(($tmpfs_size * 1024 * 1024 / 512))
tmpfs_dev=$(hdid -nomount ram://$tmpfs_size_sectors)
newfs_hfs -v "tmpfs" $tmpfs_dev
mkdir -p $tmpfs_target
mount -o noatime -t hfs $tmpfs_dev $tmpfs_target
echo "unmount with: umount $tmpfs_target && diskutil eject $tmpfs_dev"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment