Does OS X have an equivalent to /dev/shm?

走远了吗. 提交于 2019-12-02 14:38:25

You can create and mount a ram based disk as follows:

  1. Create a disk

    $ hdiutil attach -nomount ram://$((2 * 1024 * SIZE_IN_MB))
    

    hdiutil will return the name of the ramdisk.

  2. Format and mount the disk

    diskutil eraseVolume HFS+ RAMDisk NAME_OF_DISK
    

Creating a 100MB ramdisk:

$ hdiutil attach -nomount ram://$((2 * 1024 * 100))
/dev/disk3

$ diskutil eraseVolume HFS+ RAMDisk /dev/disk3
Started erase on disk3
Unmounting disk
Erasing
Initialized /dev/rdisk3 as a 100 MB case-insensitive HFS Plus volume
Mounting disk
Finished erase on disk3 RAMDisk

Original source: http://www.frederico-araujo.com/2008/12/18/blazing-fast-firefox-using-osx-ramdisk/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!