Protect your Mac from malware
macOS has many features that help protect your Mac and your personal information from malicious software, or malware. One common way malware is distributed is by embedding it in a harmless-looking app.
You can reduce this risk by using software only from reliable sources. Privacy & Security settings allow you to specify the sources of software installed on your Mac.
On your Mac, choose Apple menu > System Settings, then click Privacy & Security in the sidebar. (You may need to scroll down.)
Go to Security, click the pop-up menu next to "Allow apps downloaded from", then choose the sources from which you’ll allow software to be installed:
App Store: Allows apps only from the Mac App Store. This is the most secure setting. All the developers of apps in the Mac App Store are identified by Apple, and each app is reviewed before it’s accepted. macOS checks the app before it opens the first time to be certain it hasn’t been modified since the developer shipped it. If there’s ever a problem with an app, Apple removes it from the Mac App Store.
App Store and identified developers: Allows apps from the Mac App Store and apps from identified developers. Identified developers are registered with Apple and can optionally upload their apps to Apple for a security check. If problems occur with an app, Apple can revoke its authorisation. macOS checks the app before it opens the first time to be certain it hasn’t been modified since the developer shipped it.
In addition to apps, other types of files may not be safe. Scripts, web archives and Java archives have the potential to cause harm to your system. Of course, not all files like this are unsafe, but you should exercise caution when opening any such downloaded file. An alert appears when you first try to open these files. See Open an app by overriding security settings.