Restrict which apps can run

The Gatekeeper allows you to choose from where apps can be installed. You can choose to only allow apps from the App Store to be installed or apps from the App Store and from identified developers.

To choose one of these option, go to Apple -> System Preferences -> Security & Privacy -> General

You can still install apps from anywhere, but you must specifically approve each app separately on the General tab on the Security & Privacy screen in the System Preferences.