define local keyword globally in a macports config
I'm assuming you're on a system &lt; Mavericks because otherwise libc++ and a recent clang would already be your default and forcing it wouldn't make a lot of sense.

Use MacPorts trunk (or wait for the 2.3 release) and set the following options in $prefix/etc/macports.conf:


cxx_stdlib libc++
buildfromsource always
delete_la_files yes


If you use Xcode >= 4.2 I wouldn't bother changing the default compiler, since system clang is already the preferred MacPorts compiler and some ports specifically change that if that doesn't work (which might break if you force it to be a different compiler). If a port doesn't work with your version of system clang, but will work with a newer clang, ports will usually automatically choose a macports-clang instead.

If you use Xcode &lt; 4.2, add default_compilers macports-clang-3.4 macports-clang-3.3 macports-llvm-gcc-4.2 apple-gcc-4.2 to your macports.conf. Note that doing this is entirely unsupported, deliberately undocumented, and if it breaks you get to keep the pieces.

You need to reinstall all your ports after doing that.