Question

I seem to be in some kind of DerivedData hell.

On machine A I have an Xcode 4 workspace containing two OSX projects. One is a static library. The other is an application that links to the static library from the workspace. Everything is working fine on one machine.

Now I push this from Machine A to a git repository and pull it from Machine B. The link to the static library is broken, because apparently it included the (partly randomly generated) path to the DerivedData directory from Machine A. The DerivedData path on Machine B has a different randomly generated part.

Help? Am I doing something wrong?

Was it helpful?

Solution

Well, inevitably, despite looking for a solution to this for days, I figured it out a few minutes after posting the question.

  • In Xcode go to File|Workspace Settings...
  • Change the Derived Data Location to Workspace-relative
  • In each project that references a workspace library, remove and re-add the library

That's it. The derived data will now be in a simply and consistently named subdirectory of the directory the xcworkspace file is located in.

Make sure you've added this directory to your source control system ignore list (e.g. .gitignore, ~/.gitignore_global)!

You might be tempted to use a custom directory. Be aware that if you do the absolute path will be saved in the xcworkspace settings. If the path doesn't exist on another machine the build will fail - this happened to me because I have my user directory on a different drive on my desktop machine, so that path was invalid on my single drive laptop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top