title: Troubleshooting a framework which appears in red in my project in XCode 4.5
body: <p>When building any Mac OS X application which uses any framework which doesn't come in built in to the core, that is, some third party frameworks, it seems fairly common that I have problems where the framework appears in red when I look at it in XCode 4.5. </p>
  
  <p>There are two most common places where it can appear in red, one in the project navigator pane (left side) and one in the build phases area. And a third place, in the Copy Files area, is often shown in red. All three have different causes.</p>
  
  <p>Here's what it looks like when all three places are showing in red:</p>
  
  <p><img src="https://i.stack.imgur.com/xKPkD.png" alt="enter image description here"></p>
  
  <p>Clues for the observant among us: Some grayed out text after the red part suggests that XCode is possibly erroneously looking for the framework in question inside the XCode.app bundle. Also note that the framework is shown without any framework icon, just a place-holder icon is shown for the invalid framework in the image above.</p>
  
  <p>If a framework is not found at all, then, when I build, the framework's header files cannot be imported, so I get a "Lexical or Preprocessor issue".   The resolution there is to usually fix the Framework search path. However, even when that seems to be correct, I still often get the red-framework.  </p>
  
  <p>Sometimes, the icon is red, and yet, the framework search path works well enough that the compile works fine (<code>#import &lt;Thingy/Thingy.h&gt;</code> works and I don't get any lexical-or-preprocessor-issue), but the project won't link or <strong>crashes when run</strong>, because the framework is referenced accurately at the compile stage, but not at the link or not at the copy files phase. </p>
  
  <p>Here is a sample of what it would have looked like if XCode could not import the header file that is inside the framework:</p>
  
  <p><img src="https://i.stack.imgur.com/ic7jE.png" alt="enter image description here"></p>
  
  <p>This question is supposed to be <strong>general</strong>, and useful to anyone in future who sees a "red" framework in the list of frameworks.  Yes, I've gone to the vendor to ask the vendor for help with their framework, that should be step one. However, I feel that the "XCode shows framework in red" is confusing enough that it deserves a general helpful answer, thus this question.  Also, I have reason to believe that in this case, the vendor's installer works just fine, and this is a local problem on my machine, that other people might have in the future and might like help understanding and fixing.</p>
  
  <p>After tearing my hair out, I figured out  I can solve this problem in a really bad way, by copying the frameworks which appear in red into <code>/Applications/Xcode.app/Contents/Developer/Library/Frameworks</code> but that is probably NOT the right way to do it.   It just seems wrong to do that.  If I copy the frameworks that are located in /Developer/VendorName into the xcode app bundle's library/Frameworks, I can avoid the compiler not finding the framework.  </p>
  
  <p>The third party frameworks are currently automatically installed into a folder underneath <code>/Developer</code> that is named for the company that made the frameworks.  Is XCode supposed to search all folders automatically under <code>/Developer</code> and locate those frameworks somehow?<br>
  Currently I'm guessing, that <strong>no it can't, so XCode probably has to be told exactly the path to find this third party framework, each and every time</strong>.</p>
  
  <p>I have not been able to locate the Apple documentation on "how Xcode finds frameworks". There is a question <a href="https://stackoverflow.com/questions/1884426/how-does-xcode-know-where-to-look-for-a-framework/1884512#comment20144298_1884512">here</a> that asks just that, but the answers all deal with GCC header search paths, not with how Xcode finds frameworks and builds that search path.</p>
  
  <p>What folders does XCode 4.5 search to locate libraries? Is the <code>/Developer</code> folder still searched even though XCode 4.5 itself is no longer in <code>/Developer</code>?</p>
  
  <p>When a third party framework is to be installed for Mac OS X client usage, where should it be installed to, and how do you check if the installer worked? Is there some command line invocation that can list all available frameworks that are visible to XCode and installed on my system?</p>
  
  <p><strong>Footnote:</strong>
   A second style of working is to use the "Add Other" button to find a framework which is not in a known location, if I use that, then I often end up stuck with a project that builds, but which still fails at runtime, because the Copy Files feature doesn't find and copy things, because adding a framework to the copy phase using the plus button appears to be broken in XCode. There is a workaround though.  I am asking initially how to work so that you don't need to use Add Other, but, if Add Other is the only way to go for third party frameworks, then, I still get stuck with the Copy Files feature not working. I believe that the solution to this is that the XCode project's own Framework Search path is not set up correctly for my system, and that's all I need to do to fix this particular case.  In a nutshell, I'm wondering what the Global "Framework Search Path" is, and where it's set?  Or is there ONLY an XCode project search path, and not a global framework search path?  If I clean up the Framework search path, and then use Add Other to add the new framework, and carefully right-click and remove all Red items from the project navigator pane, and if I use only mouse drag and drop and do not use the + button to add frameworks to the Copy files, then I can get a framework in a private search path location to build and copy.  Any attempt to use the + button in the Copy Files area, and to add a framework via that dialog appears to be blocked from working by some kind of odd XCode bugs where it adds the framework at the wrong location, as shown in the first picture above, where it has mis-remembered or cached that the third-party Framework is supposed to be in the Developer/Library/Frameworks folder inside the XCode.app bundle. </p>