I am using LD_PRELOAD to hook a library function, and in Linux it works perfectly. But I cannot figure out how to do the equivalent in OSX.
LD_PRELOAD
The setup I
Take a look at DYLD_INSERT_LIBRARIES. That's the variable you're looking for.
See also this answer.