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 allows you to install software from sources other than the Mac App Store