To ‘allow applications downloaded from anywhere’ from the command line, enter the following into Terminal
sudo spctl --master-disable
This changes the option located in System Preferences, Security & Privacy, General
This will allow you to install software from sources other than the Mac App Store