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?
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
open
calls are reported as open_nocancel
on osx. same wrt. read
and read_nocancel
. –
Odel open
calls are reported as open_nocancel
on osx. same wrt. read
recv
close
and perhaps a bunch/all others, they seems to have *_nocancel
counterparts. –
Odel 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
–
Ayrshire dtruss
in your answer is broken. –
Dicky /legacy/
now. –
Stuckey $ 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
–
Jinajingle dtruss
as an strace
/ltrace
replacement on macOS (since roughly 2018) is to disable SIP through csrutil disable
in recovery mode. It's unfortunate, especially if one only needs it for a quick session to see which files are opened by process or similar query tasks. –
Malleolus © 2022 - 2024 — McMap. All rights reserved.