Skip to content

How to enable ccache with OS X MacPorts


I’ve had a 13″ Macbook for about your years now. When I learned about MacPorts I was really happy to know I could run newer software, and compile things to my liking. These days I run a development environment on my Macbook, all built using MacPorts.

This post covers how to leverage ccache in compiling your MacPorts. ccache is a compiler cache utility that increases the efficiency of your compiles by reusing cached build data, often improving build times by 5-10 times!

Step 1: Install ccache

sudo port install ccache

Step2: Edit macports.conf”

Open /opt/local/etc/macports/macports.conf in your favorite editor. Find the line ‘configureccache’ (near line 65)

configureccache no

and change it to

configureccache yes

You’re done! New compiles will now use ccache.

note: ccache stores it’s cached date in your home directory, ie; /Users/$username/.ccache. It defaults to a maximum cache storage size of 1G. You can find out more about the ccache settings via the ‘ccache -s’ command.

Related Posts

  1. Fix Home and End Keys: Mac OS X
  2. Google Chrome Developer Preview Available For OS X