There are two solutions to this problem:
-
System Preferences -> Security & Privacy -> Security -> Modify to Anywhere
-
Open the terminal and enter:
- For macOS10.12 - 10.15.7: sudo spctl –master-disable
- For macOS11 and later versions: sudo spctl –global-disable