why

The problem was caused by Apple’s new policy SIP: System Integrity Protection SIP

impact

Operation not permitted when you run commands such as sudo ls CD in these directories

/System
/usr
/bin
/sbin
/var
Apps that are pre-installed with OS X
Copy the code

The solution

  1. Reboot your Mac into Recovery Mode by restarting your computer and holding down Command+R until the Apple logo appears on your screen.
  2. After select a language. Then click Utilities > Terminal in the top menu.
  3. In the Terminal window, type in csrutil disable and press Enter. and use csrutil status to check the status
  4. Restart your Mac.
  5. use the same command in some directory then check if it works.