1. Download Xcode from https://developer.apple.com/download/more/ (this requeires to Login in with an Apple Developer Account)
At the moment id don´t know how to authenticate so i have no clue to download the xip via curl/wget.
In my case i downloaded the file and copied it via scp to my mac.
eg. for Xcode 9.2 https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_9.2/Xcode_9.2.xip
pkgutil --verbose --check-signature path/to/xip
eg. pkgutil --verbose --check-signature Xcode_9.2.xip
xar -xf path/to/xip
eg. xar -xf Xcode_9.2.xip
After a little search, I end up with a convenient solution.
brew install pbxz
pbxz -n Content | tar -x -v
The pbxz -n Content
read the content. then tar would extract the content to Xcode.app
.
sudo mv ./Xcode.app /Applications/