I'm trying to develop a program using Xcode on macOS.

The program compiles and links fine, but when trying to execute it, I get an error message stating that a library can't be found in "/usr/local/lib".

The library in question is actually developed by myself, and is part of the project bundle.

How can I install my program in order to test it inside Xcode?

  • Can you detail which library it is that it cannot find?
    – jksoegaard
    Jun 9, 2019 at 22:00
  • Yeah. If you don’t build in Xcode, just open the inspector once you have a program running and attach to that process. If your software is built from the command line, use a command line debugger. You might need a second question or to edit this based on what you seek to do.
    – bmike
    Jun 9, 2019 at 22:04
  • @jksoegaard, question updated with explanation.
    – Igor
    Jun 9, 2019 at 22:06
  • @bmike Your answer has no relation whatsoever to the question. This is not about inspectors or debuggers at all.
    – jksoegaard
    Jun 9, 2019 at 22:13
  • You might be right @jksoegaard - that’s why I didn’t answer and commented to seek clarification. In my mind it was 50/50 chance the “build” was in Xcode or not. The whole “install my program” has me quite confused what’s actually going on. +1 for the efforts and comments
    – bmike
    Jun 9, 2019 at 23:32

1 Answer 1


There's no such "install" function in Xcode.

If your program needs a library in order to run, you'll need to either bundle the library with the program or create an installer that copies the library and your application into place.

You can bundle the library with the program by statically linking (effectively not having a library at runtime) - or by embedding. Embedded is explained by Apple here:


Usually on development machines, you install internal dependencies such as libraries through the use of build scripts or build steps addded in Xcode. You could simply add a new Build Phase (named "Copy Library" or similar) - and then add a Copy Files step, where you copy your .dylib (or .so or whatever) to the intended destination.

  • @ksoegaard, the thing is that the library the linker is looking for is part of my project. So definitly HomeBrew is not work work here. And I'm not sure about the other option...
    – Igor
    Jun 9, 2019 at 22:04
  • 1
    @Igor Okay, that was not part of your question before - I'll update the answer!
    – jksoegaard
    Jun 9, 2019 at 22:14
  • @ksoegaard, are you saying that during the development I should create the new "Build Phase" and when its ready for release I should embed the library as explained in the link you posted? Also, does this link explains how to create this extra "Build Phase" and what to put in it or it talks only about embedding? Sorry I'm new to Apple development
    – Igor
    Jun 9, 2019 at 22:30
  • If you're not going to embed a framework, then create a manual build phase or build script for copying over the file to /usr/local/lib or whereever you need it. If you're going to embed the framework, that's not needed as the file needs to be placed within your app folder. The link only explains how to embed, not the build phase - I explained that in the answer.
    – jksoegaard
    Jun 9, 2019 at 23:08
  • Please also understand that this is not something special for "Apple development". It is the same on Linux. On Linux you usually include the copying of the library in a Makefile (i.e. the same as adding a Build Phase), or your statically link or otherwise embed the library.
    – jksoegaard
    Jun 9, 2019 at 23:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .