How to Create a 4GB/s RAM Disk in Mac OS X » TekRevue: Open the Terminal app from Applications > Utilities and enter the following command:
diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://XXXXX`
Replace the X characters with a number that represents the block size for the total capacity of your RAM Disk. Calculate this number my multiplying your desired size of disk in megabytes by 2048. In our example, we’ll create a 4 GB RAM Disk, which requires a number of 8388608 (4096 * 2048). Input this number in place of the X characters in the command above:
diskutil erasevolume HFS+ 'RAM Disk' `hdiutil attach -nomount ram://8388608`