1. Open Terminal (Applications -> Utilities -> Terminal)
2. Type the following command in Terminal. Be prepared to wait about 2 to 5 minutes for Sysdiagnose to completely run.
sudo sysdiagnose –f ~/Desktop/
Link:
https://becomethesolution.com/mac/mac-os-x-sysdiagnose-advanced-mac-troubleshooting-diagnostics