4 ms·
"virtually every Unix system already has it mounted as a tmpfs by default" might be true if you say Linux instead, but Mac doesn't have /dev/shm
by frollogaston 1y ago
"virtually every Unix system already has it mounted as a tmpfs by default" might be true if you say Linux instead, but Mac doesn't have /dev/shm
- loeg 1y agoI may misremember, but I think it's also common in the BSDs? (Whereas /var/tmp is persisted.)
- frollogaston 1y agoYeah, Mac is probably the odd one out, but it's also maybe the most common Unix-based/Unix-like desktop OS. Anyway, both are POSIX, unlike Linux.
- hiAndrewQuinn 1y agoMea culpa, you're right. I should not have assumed that just because POSIX was mentioned in the orbit of this thing that everyone else had this too. The article has been corrected.
- AdieuToLogic 1y agoOS-X/macOS supports RAM drives and a script which defines one for use as /private/tmp (which /tmp is symbolically linked to) is: #!/bin/bash ramfs_size_mb=1024 mount_point=/private/tmp counter=0 ramfs_size_sectors=$((${ramfs_size_mb}*2048)) ramdisk_dev=`hdiutil attach -nomount ram://${ramfs_size_sectors}` while [[ ! -d "/Volumes" ]] do sleep 1 counter=$((counter + 1)) if [[ $counter -gt 10 ]] then echo "$O: /Volumes never created" exit 1 fi done diskutil eraseVolume HFS+ 'RAM Disk' ${ramdisk_dev} || { echo "$O: unable to create RAM Disk on: ${ramdisk_dev}" exit 2 } umount '/Volumes/RAM Disk' mkdir -p ${mount_point} 2>/dev/null mount -o noatime -t hfs ${ramdisk_dev} ${mount_point} || { echo "$0: unable to mount ${ramdisk_dev} ${mount_point}" exit 3 } chown root:wheel ${mount_point} chmod 1777 ${mount_point} Adding a plist definition to /Library/LaunchDaemons can ensure the above is executed when the system starts.