Declare DYLD environment variables

Product :4D - 4D Server
4D : v13.2
OS : Mac OS X 10.12

After migrating to OSX 10.12 SIERRA the 4D in interpretated mode stoped connecting to Database.

Found out that it is caused due to the mac system integrity protection is blocking the Envirnment variables started by DYLD to be passed to child processes. (last coment)

So even if i have the variable set on main process, when opening a new app it will not see the variable.

I use the DYLD_LIBRARY_PATH variable to set the connection to the database (SYBASE in my case).

in compiled apps i can overpass this issue editing the apps plist and include this in it

DYLD_LIBRARY_PATH /Applications/Pixar/RenderManProServer-21.4/lib

Does anyone knows how to solve this problem?
Disabling the mac system integrity protection is not a solution for me.

Thank you.

Rui Rodrigues

I would consider> to be a debugger tool, it seems odd that a program or library should depend on it to find its peer.

you could place the .dylib adjacent to your executable or library and take advantage of




instead of an absolute path.

first, run

otool -L to see where the library is searched,


install_name_tool -id


install_name_tool -change

to use “relative” paths.

Thanks for your reply.

Not sure if i understood your answer or maybe i just wasn’t clear enough.
using those command you’ve mentioned is not our strenght (on the other hand, we are very basic when it comes to that).

I have several apps that connect to a sybase database.
To connect we use a plugin 4DLSQL.bundle which needs to load the dylibs,
The plugin uses the environment variable DYLD_LIBRARY_PATH that has /Applications/Sybase/System/OCS-15_0/lib as its value. This folder is where i have all the needed dylib files.

AS a new feature since osx 10.11, for all child process (new apps that we open) the Environment variables that start with DYLD are not passed and therefore the child process (the app) will not “Know” that path.

SO my problem is that when we are developping an app in 4D, the 4D itself does not have this path and do not know the DYLD Env variable so it cannot connect to the database.

After i compile the app i can solve the issue by adding a key into Info.plist file of the app like i mentioned before, but i cannot do this to it self. I’ve tryed but did not work.

Thans again for your time and help, but we are really blocked here.

Rui Rodrigues.

I am not aware of the plugin “4DLSQL.bundle”
but I guess it is a bespoke plugin developed in C/C++.

I am not familiar with the license terms or technologies involved, if possible, you should consult the developer of the plugin.

from a technical point of view, here is how it works:

in side *.bundle/Contents/MacOS/ there is an executable.
the if you run the command line,
otool -L {the executable]
you will get a list of its dependencies.

one (or more) of it would be the paths to the *.dylib that it requires.
and then, the .dylib may reference more libraries.

when a program loads an executable or plugin, these libraries are searched in specific locations (I suppose you know haw the environment variable $PATH works). that search path is generally extended with LD_LIBRARY_PATH.

on an *IX system, the library path can be standard absolute, such as
/usr/lib/*dylib or /usr/local/lib/*dylib.

it can also be relative, such as

@executable_path/*dylib (relative to 4D) or @loader_path/*dylib (relative to plugin)

so, in theory, if the path returned by otool -L is *.dylib, you could change it to

install_name_tool -change .dylib /Applications/Sybase/System/OCS-15_0/lib/.dylib {the plugin binary path}

alternatively you could put the dylib inside the plugin, change its id to a path relative to the plugin.


otool -L {the dylib path]

to find out its path, then

install_name_tool -id *.dylib @loader_path/*dylib {the dylib path]


install_name_tool -change .dylib @loader_path/.dylib {the plugin binary path}

but again, you should talk to the plugin developer.

Hello again,

Thanks for the tips.

Going to try the solution.

I’ll let you know the outcome of it.

Rui Rodrigues