Skip to content

Downloading and installing xcode headless scriptless

_Qubarf edited this page Sep 17, 2022 · 8 revisions

* in hindsight, it'd probably be easier to just use one of the many xcode cli installers A bit of a convoluted process but should allow you to download XCode without needing additional scripts and having to setup the appstore

  1. Go here and select the xcode version appropriate for your version of mac I was using the pre-setup Catalina docker, so I chose this version

  2. Now if it asks you to sign in, do so and accept the terms and conditions

  3. Now click the download button and then:

    • Either download the xip file onto your host OS and transfer via sFTP or other means
    1. Alternatively, at this point the page should switch to buffering logo and remain stuck there. Use a cookie view (I used the chrome extension EditThisCookie) and copy the value for ADCDownloadAuth.

    2. On your guest machine make a file called cookies.txt and add the cookie in the form .apple.com TRUE / FALSE 1679146596 ADCDownloadAuth [cookie value]

    3. I assume you have homebrew installed, download wget and use the command wget --load-cookies cookies.txt [xip download link] - ~10gb Xcode.xip should download

  4. Then simply a matter of configuration:

    xip --expand [xcode.xip]

    sudo cp Xcode.app /Applications

    sudo rm /Library/DeveloperCommandLineTools && xcode-select -r

    sudo xcodebuild -license accept

    sudo xcodebuild -runFirstLaunch (took ~10 minutes for me)

    DevToolsSecurity -enable

  5. Remote development can be achieved via VSCode through ssh

    1. E.g., for swift make sure to change the sourcekit-lsp path to be the output of xcrun --find sourcekit-lsp