因为macOS
默认打开System Integrity Protection,所以无法使用DTrace
:
$ dtrace -l
dtrace: system integrity protection is on, some features will not be available
dtrace: failed to initialize dtrace: DTrace requires additional privileges
所以如果要使用DTrace
,需要关闭System Integrity Protection
功能:参考Disabling and Enabling System Integrity Protection。需要注意的是,进入Recovery mode.在苹果处理器和英特尔处理器是不一样的。在关闭System Integrity Protection
后,DTrace
就可以使用了:
$ dtrace -l
dtrace: failed to initialize dtrace: DTrace requires additional privileges
$ sudo dtrace -l | more
Password:
ID PROVIDER MODULE FUNCTION NAME
1 dtrace BEGIN
2 dtrace END
3 dtrace ERROR
......