Installing a software from Xcode

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?


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:

https://developer.apple.com/library/archive/technotes/tn2435/_index.html

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.