Accept the XCode license without the popup

sudo xcodebuild -license accept

Check out my other post How to install additional components to XCode from commandline/shell for more XCode automation.