April 14, 2014

Moarfonts after upgrading Xcode

We are using moarfonts for WSYIWYG-style preview in Interface Builder. And if you’r not doing it yet, you really should. However, after upgrading to Xcode 5.1.1 some of the team members started seeing a strange error while building the project.

Failed to install XXX: The file “XXX.ttf” couldn’t be opened because there is no such file.

After fruitless googling for possible solutions, we took a closer look at the binary that makes moarfonts magic possible. Trying to run $ moarfonts in the command line revealed moarfonts reset. And although there is no documentation, it looked promising. However you can’t run it if you don’t have an SDKROOT environment variable set. So we ended up with the following cure:

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk
moarfonts reset

That’s it. Clean Derived Data and build folder, restart Xcode and re-run your build. Hope it helps!

Update: Cédric Luthi published troubleshooting guide you should refer to

Update Hail Xcode 6, the script is not needed anymore!