This is useful for debugging (hence programming related). On linux, we can use the command
strace -feopen python myfile.py
to figure out which python modules and shared objects are loaded. Is there an equivalent one-liner on macOS X?
I suppose you meant strace -fetrace=open
?
dtruss -f -t open python myfile.py
dtruss
requires root privileges, but you might not want to run the command you want traced as root. Consider sudo dtruss -f -t open sudo -u $USER python myfile.py
Jul 27, 2014 at 17:48
$ sudo dtruss -f -t open sudo -u $USER python
: ` dtrace: system integrity protection is on, some features will not be available` and then dtrace: failed to execute sudo: dtrace cannot control executables signed with restricted entitlements