In my day job, I do a lot of debugging of apps that use libraries in non-standard locations. This has traditionally been performed by exporting DYLD_LIBRARY_PATH in your environment and then debugging your app as normal.

1
2
3
4
$ export DYLD_LIBRARY_PATH=/path/to/lib/dir
# ... code
$ lldb ./myapp
(lldb) r myapp_arg1 myapp_arg2

Under El Capitan, dyld environment variables are purged when spawning processes, thanks to System Integrity Protection. This means that you’ll have to use lldb to set the variable at debug-time.

1
2
3
$ lldb ./myapp
# 'r' and 'run' are aliases to 'process launch -X true --'
(lldb) process launch -v DYLD_LIBRARY_PATH=/path/to/lib/dir -X true -- myapp_arg1 myapp_arg2

If you always use the same shared library path, you might be able to make new aliases in your .lldbinit.