Page 1 of 1

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!

Clear all

macOS - Where to put your dylib files during development without installing them?

1 Posts
1 Users
Noble Member Admin
Joined: 9 years ago
Posts: 2234
Topic starter  

From the Apple documentation:

Before you can use a dynamic library as a dependent library, the library and its header files must be installed on your computer.

The standard locations for header files are (not always needed):


The standard locations for dynamic libraries (dylib files) are:


You may also place the .dylib file at a nonstandard location in your file system, but you must add that location to one of these environment variables:



So in short, this is what I do when developing an application that needs a dylib:

1) For the development process, I copy the dylib file to ~/lib - This way my IDE (Lazarus Pascal) can find the dylib.

2) When testing for deployment, I remove the dylib from ~/lib, so I can test if I added the dylib correctly in the .app bundle.

Typically I create 2 scripts for that (MySQL client dylib example):

mkdir ~/lib
cp libmysqlclient.20.dylib ~/lib
cd ~/lib
ln -s libmysqlclient.20.dylib libmysqlclient.dylib


rm ~/lib/libmysqlclient.dylib
rm ~/lib/libmysqlclient.20.dylib

Don't forget to do

chmod +x
chmod +x

Also note that in the install script, I do a symbolic link to a generic name (no version number).