The main problem when compiling is the tons of disk access that compile involves from compiling, linking, stripping etc… if you have a regular hard disk you know this may take a lot of time, most if the project is large. If you have an SSD the problem is not the speed, but still the lots of read/write access even when SSDs are pretty much more reliable that they were years ago.
A simple fix is to use ram disk. I’m not going to tell you how to do it in linux, because in linux you basically mount tmpfs in a directory and you are done, but in OS X this may be a bit tricky. In particular if we talk about macports.
Macports build directory is /opt/local/var/macports/build, so we need to mount a ramdisk here. But first we need to create it.
hdiutil attach -nomount ram://2097152 /dev/disk10
That should create a ramdisk with about 1GB, if you want to use less or more ram you can of course tune the “ram” parameter to fit what’s best for you, it doesn’t means the size in bytes/kbytes, it mean the number of 512 bytes sectors. Then format and mount in /opt/local/var/macports/build:
newfs_hfs /dev/disk10 sudo mount -t hfs /dev/disk10 /opt/local/var/macports/build
And you are done, just use macports as usual. Please note that there might be some ports that fails to build because some of them expect the build directory to be in the same storage .
After you are done compiling you probably want to delete that ramdisk, just use hdiutil detach $dev for that.
3,778 total views, 1 views today