2017-05-19 19:05:12 +02:00
|
|
|
README file for libfaketime on macOS
|
|
|
|
|
====================================
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2017-05-19 19:05:12 +02:00
|
|
|
Support for macOS has meanwhile matured and many command line and
|
2014-02-14 15:59:06 +01:00
|
|
|
GUI applications will run stable.
|
2013-09-02 14:09:32 +02:00
|
|
|
|
2018-10-02 22:02:30 -04:00
|
|
|
Developments and tests are done on Mojave currently.
|
2013-09-02 14:09:32 +02:00
|
|
|
|
2019-08-23 15:24:13 +02:00
|
|
|
Version 0.9.5 and higher no longer work with OSX <= 10.6 due to
|
2014-02-14 15:59:06 +01:00
|
|
|
changes in the underlying system libraries. If you need libfaketime
|
|
|
|
|
on OSX <= 10.6, please use libfaketime version 0.9.
|
2013-09-02 14:09:32 +02:00
|
|
|
|
2019-08-23 15:24:13 +02:00
|
|
|
Installing and using libfaketime on macOS is slightly different than
|
2011-10-19 21:03:41 +02:00
|
|
|
on Linux. Please make sure to read the README file for general
|
2019-08-23 15:24:13 +02:00
|
|
|
setup and usage, and refer to this file only about macOS specifics.
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
|
2017-05-19 19:05:12 +02:00
|
|
|
1) Installing libfaketime on macOS
|
|
|
|
|
----------------------------------
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2013-10-11 23:37:50 +02:00
|
|
|
If you use MacPorts, libfaketime can be installed on the command line
|
|
|
|
|
as follows:
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2013-10-11 23:37:50 +02:00
|
|
|
sudo port install libfaketime
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2014-02-14 15:59:06 +01:00
|
|
|
Or, if you use Fink, install using:
|
2013-10-27 21:53:19 +01:00
|
|
|
|
|
|
|
|
fink install libfaketime
|
|
|
|
|
|
2014-02-14 15:59:06 +01:00
|
|
|
Or, if you use Homebrew, install using:
|
|
|
|
|
|
|
|
|
|
brew install libfaketime
|
|
|
|
|
|
2019-08-23 15:24:13 +02:00
|
|
|
Please inform the respective package maintainers if the latest release
|
|
|
|
|
is not yet available this way. With homebrew, you can typically use
|
|
|
|
|
"brew install --HEAD" to install from the latest source automatically.
|
|
|
|
|
|
2014-02-14 15:59:06 +01:00
|
|
|
Otherwise, you have to compile and install libfaketime manually; this
|
2013-10-11 23:37:50 +02:00
|
|
|
will require a working installation of Xcode and its command line tools
|
|
|
|
|
on your machine.
|
|
|
|
|
|
2019-11-30 09:36:46 +01:00
|
|
|
You can compile libfaketime by running the command
|
2013-10-11 23:37:50 +02:00
|
|
|
|
2014-02-14 15:59:06 +01:00
|
|
|
make
|
|
|
|
|
|
2019-11-30 09:36:46 +01:00
|
|
|
in libfaketime's top-level directory.
|
|
|
|
|
|
2013-10-11 23:37:50 +02:00
|
|
|
The resulting library will be named libfaketime.1.dylib ; to check
|
|
|
|
|
whether it works properly, run the test suite and verify whether its
|
|
|
|
|
output is correct:
|
|
|
|
|
|
|
|
|
|
cd test
|
2019-11-30 09:36:46 +01:00
|
|
|
make -f Makefile.OSX
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
|
2017-05-19 19:05:12 +02:00
|
|
|
2) Using libfaketime from the command line on macOS
|
|
|
|
|
---------------------------------------------------
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2012-08-26 22:34:39 +03:00
|
|
|
You will need to set three environment variables. In a Terminal.app
|
2019-08-23 15:24:13 +02:00
|
|
|
or any other CLI session, the following commands can be used:
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
export DYLD_FORCE_FLAT_NAMESPACE=1
|
2013-10-11 16:33:37 +02:00
|
|
|
export DYLD_INSERT_LIBRARIES=/path/to/libfaketime.1.dylib
|
2011-10-19 21:03:41 +02:00
|
|
|
export FAKETIME="your favorite faketime-spec here"
|
|
|
|
|
|
|
|
|
|
Please refer to the general README file concerning the format
|
|
|
|
|
of the FAKETIME environment variable value and other environment
|
|
|
|
|
variables that are related to it.
|
|
|
|
|
|
2017-05-19 19:05:12 +02:00
|
|
|
The "faketime" wrapper application has been adapted to macOS;
|
2011-10-19 21:03:41 +02:00
|
|
|
it offers the same limited libfaketime functionality as on Linux
|
|
|
|
|
in a simple-to-use manner without the need to manually set
|
2013-10-11 23:37:50 +02:00
|
|
|
those environment variables. Run "faketime" without parameters
|
|
|
|
|
for help and use "man faketime" for details.
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
3) Integrating libfaketime with applications
|
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
|
|
|
|
Given the limited number of system calls libfaketime intercepts,
|
2019-08-23 15:24:13 +02:00
|
|
|
it may not work too well with specific GUI applications on macOS.
|
2013-09-02 14:09:32 +02:00
|
|
|
This can result in crashes after a seemingly random time, or an
|
|
|
|
|
application will not or at least not always see the faked time,
|
|
|
|
|
and so on.
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
A safe way to try out whether a specific application works fine
|
|
|
|
|
with libfaketime is to start it from the command line. Perform
|
|
|
|
|
the steps outlined above and run the application by issuing the
|
|
|
|
|
following command:
|
|
|
|
|
|
|
|
|
|
/Applications/ApplicationName.app/Contents/MacOS/ApplicationName
|
|
|
|
|
|
|
|
|
|
(Make sure to replace "ApplicationName" twice in that command with
|
|
|
|
|
the name of your actual application.)
|
|
|
|
|
|
|
|
|
|
If it works fine, you can configure the application to permanently
|
2012-08-26 22:34:39 +03:00
|
|
|
run with libfaketime by editing its Info.plist file. Add the
|
2011-10-19 21:03:41 +02:00
|
|
|
LSEnvironment key unless it is already there and add a dictionary
|
|
|
|
|
with the three keys like this:
|
|
|
|
|
|
|
|
|
|
<key>LSEnvironment</key>
|
|
|
|
|
<dict>
|
|
|
|
|
<key>DYLD_FORCE_FLAT_NAMESPACE</key>
|
|
|
|
|
<string>1</string>
|
|
|
|
|
<key>DYLD_INSERT_LIBRARIES</key>
|
2013-10-11 16:33:37 +02:00
|
|
|
<string>/path/to/libfaketime.1.dylib</string>
|
2011-10-19 21:03:41 +02:00
|
|
|
<key>FAKETIME</key>
|
|
|
|
|
<string>value of FAKETIME here</string>
|
|
|
|
|
</dict>
|
|
|
|
|
|
|
|
|
|
(If the application is installed in /Applications instead of in
|
|
|
|
|
$HOME/Applications, you eventually will need root privileges. If
|
|
|
|
|
the application's Info.plist is not in XML, but in binary format,
|
|
|
|
|
use appropriate editing or conversion tools.)
|
|
|
|
|
|
|
|
|
|
Afterwards, you will probably need to run
|
|
|
|
|
|
2013-10-11 23:37:50 +02:00
|
|
|
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/ApplicationName.app
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
to make sure the change to Info.plist does not go unnoticed.
|
|
|
|
|
|
2012-08-26 22:34:39 +03:00
|
|
|
Please note that modifications to Info.plist will be lost when the
|
|
|
|
|
application is updated, so this process needs to be repeated after
|
2011-10-19 23:03:53 +02:00
|
|
|
such updates, including own new builds when using Xcode.
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2013-09-02 14:09:32 +02:00
|
|
|
Please feel free to report non-working applications on the Github
|
|
|
|
|
libfaketime issues website. This may help us to identify further
|
2017-05-19 19:05:12 +02:00
|
|
|
time-related system calls that need to be intercepted on macOS.
|
2013-09-02 14:09:32 +02:00
|
|
|
|
|
|
|
|
https://github.com/wolfcw/libfaketime/issues
|
|
|
|
|
|
2019-08-23 15:24:13 +02:00
|
|
|
However, there are two important aspects:
|
|
|
|
|
|
|
|
|
|
- When reporting non-working applications, please make sure that your issue is
|
|
|
|
|
not related to SIP (system integrity protection). For example, on a
|
|
|
|
|
SIP-enabled, default macOS installation, libfaketime will not work for
|
|
|
|
|
programs like /bin/bash because the path /bin is SIP-protected. Copy your
|
|
|
|
|
application to a non-SIP-protected path, and if libfaketime still does not
|
|
|
|
|
work, feel free to report it.
|
|
|
|
|
|
|
|
|
|
- We cannot and will not help with using libfaketime for proprietary or
|
|
|
|
|
commercial software unless you are its developer trying to integrate
|
|
|
|
|
libfaketime. Please contact the developers or the vendor directly if
|
|
|
|
|
you have problems using libfaketime with non-free / not open sourced
|
|
|
|
|
macOS applications.
|
2011-10-19 21:03:41 +02:00
|
|
|
|
2017-05-19 19:05:12 +02:00
|
|
|
|
|
|
|
|
4) Notes for developers of macOS applications
|
|
|
|
|
---------------------------------------------
|
2011-10-19 21:03:41 +02:00
|
|
|
|
|
|
|
|
The environment variable FAKETIME can be changed at application run-time
|
|
|
|
|
and always takes precedence over other user-controlled settings. It can
|
2019-08-23 15:24:13 +02:00
|
|
|
be re-set to 0 (zero) to work around potential incompatibilities or if
|
|
|
|
|
you do not want libfaketime applied to your software.
|