4

Running Mac OS 10.7.2 and trying to run libfaketime and nothing happen. I installed and ran exactly as directed only the time and date stay exactly as are set in the system? Is anyone else able to successfully run this on OSX?

$ date
Mon Jan 30 21:05:09 CST 2012
$ LD_PRELOAD=./libfaketime.so.1 FAKETIME="-15d" date
Mon Jan 30 21:05:32 CST 2012
5

Use DYLD_INSERT_LIBRARIES instead of LD_PRELOAD on Mac OS. You may need to set DYLD_FORCE_FLAT_NAMESPACE as well. E.g.

DYLD_INSERT_LIBRARIES=./libfaketime.so.1 DYLD_FORCE_FLAT_NAMESPACE=y FAKETIME="-15d" date
1

If you compile the library like this:

gcc -shared -fPIC mylib.c -o mylib.so

You may create environment variables:

export DYLD_INSERT_LIBRARIES=./mylib.so
export DYLD_FORCE_FLAT_NAMESPACE=y

Then execute with the new loaded library:

./program

Obs:

Working on macOS High Sierra (v 10.13.1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.