3

I tried to find a solution but all of them are about trying to install cli-tools without Xcode. All of them eventually require the internet connection. My case is that I want to install cli-tools on a completely offline machine which was never connected to the Internet. Thus the only option is to install from files brought using USB flash.

3

You have to obtain the tools somehow. Officially you need to have access to the developer download pages at Apple. For the lowest point of entry a valid AppleID seems to suffice for that.

Then you go to the relevant download section on Apple's developer site and choose the appropriate version and download the DMG you need. That file can then be copied to your liking and for example transferred via flash drive.

  • 1
    You have to accept an "Apple Developer Agreement" logging-in with a valid AppleID for the first time - that's it. – klanomath Jan 14 '18 at 14:44
  • I'm not sure an AppleID is needed if you use xcode-select --install and then use the command line option to accept the license on the command line tools. This skips the Mac App Store and Xcode entirely, @klanomath - now the main point here is 100% correct - you need to get it online or have someone else get it and package it for you. – bmike Jan 14 '18 at 18:09
2

Just package up /Library/Developer/CommandLineTools with your deployment tool of choice (it could be as simple as using Finder to compress / zip / archive the folder or as complicated as making a signed package with an installer and receipts so you know the install status / checksum of the files, etc...)

Of course, someone needs to run xcode-select --install while connected to the internet to grab the current binaries, but there's nothing preventing you from deploying that one set of tools you download later offline.

See - How do I uninstall the command line tools for Xcode?

0

You can probably do this with AutoDMG by including XCode in your image.

  • I'd go with packaging the command line tools directory. that uses 334 MB on disk for me instead of Xcode 9.2 which uses 5700 MB on disk (and that's before first run when additional components still need to be installed). Also, Xcode from the App Store is licensed with an AppleID which when packaged. can be problematic to communicate with the online store to validate the receipt or validate that AppleID against that Mac. Not a -1 vote worthy criticism , but this is probably a bad idea overall. – bmike Jan 14 '18 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .