Categories
Swift Kick

How to fix the “Apple Mach-O Linker / Undefined symbols for architecture” error in Xcode 6 beta 6

swift kickIf you’ve been faithfully downloading all the Xcode 6 betas to work with the latest version of Swift, you’re probably used to dealing with new betas breaking your code. In many cases, it’s due to changes in Swift, but once in a while, it’ll be completely unrelated to the language.

When I tried to compile my simple shoot ’em up game using Xcode 6 beta 6, I kept getting a couple of errors with text like this:

Apple Mach-O Linker error, Undefined symbols for architecture

You’re pretty insulated from the details of compiling and linking in Swift, and I hadn’t modified the code since I last ran it in beta 5, which left Xcode as the thing that changed and broke the build. A quick search on Stack Overflow revealed that deleting the DerivedData directory, which contains dSYM data (debug symbols — information used during the build process and for debugging), fixes the problem.

The default location for DerivedData is:

/Users/[your username]/Library/Developer/Xcode/DerivedData

Wait! I can’t find the Library folder in my home directory!

The Library folder is hidden by default in order to prevent non-technical users from messing around with it. However, as a developer, there are times that you’ll need to access it. Here’s how you make it visible within Finder in Mavericks:

  1. Open a Finder window.
  2. Go to your Home folder (the keyboard shortcut is commandShift-H).
  3. In the View menu, select Show View Options (the keyboard shortcut is command-J).
  4. Make sure that the Show Library Folder checkbox is checked.

view options window

One reply on “How to fix the “Apple Mach-O Linker / Undefined symbols for architecture” error in Xcode 6 beta 6”

Comments are closed.