How to install command line tools offline?

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.


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.


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?