I'm extremely surprised this question wasn't asked, or at least I wasn't able to find it.
Is there a way to install command line tools for MacOS without installing the full XCode suite? I'm low on storage and I find it hard to swallow that I have to free up 20+ GB just to be able to do:
$ python -m http.server
Especially since python is already installed...
EDIT #2: This was just an example, my question is about xcode cli tools.
I want to be able to use make, gcc, install brew packages etc...
EDIT: Replying to the comment and why I think "python is installed"
Simple: Everything was working, until I uninstalled XCode to free up 11GB that I needed (and I don't use XCode at all). Also:
$ which python3
/usr/bin/python3
$ ls -lh /usr/bin/python3
-rwxr-xr-x 76 root wheel 163K May 9 2022 /usr/bin/python3
$ file /usr/bin/python3
/usr/bin/python3: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64
- Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e
- Mach-O 64-bit executable arm64e]
/usr/bin/python3 (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python3 (for architecture arm64e): Mach-O 64-bit executable arm64e
$ hexdump -C /usr/bin/python3 | head
00000000 ca fe ba be 00 00 00 02 01 00 00 07 00 00 00 03 |............|
00000010 00 00 40 00 00 01 0c f0 00 00 00 0e 01 00 00 0c |..@............|
00000020 80 00 00 02 00 01 80 00 00 01 0c d0 00 00 00 0e |...............|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00004000 cf fa ed fe 07 00 00 01 03 00 00 00 02 00 00 00 |............|
00004010 12 00 00 00 40 06 00 00 85 00 20 00 00 00 00 00 |....@..... .....|
00004020 19 00 00 00 48 00 00 00 5f 5f 50 41 47 45 5a 45 |....H...__PAGEZE|
00004030 52 4f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |RO..............|
00004040 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 |................|
$ md5sum /usr/bin/python3
fac4668657765c8dfe89d8995acfb5a2 /usr/bin/python3
$ python3 -m http.server
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
PS: I know this answer exists but it assumes I get to choose anything after running xcode-select --install which hasn't been the case since Big Sur as far as I know
http.server. Re the answer you link, it certainly doesn't say what you seem to think it says, even ignoring the Homebrew bias. If you want the CLT, install the CLT, withxcode-select --install. – Marc Wilson Nov 22 '22 at 15:47About the the link: "For my machine, running
xcode-select --installand choosing to install the tools from the window that popped up helped fix the problem". Maybe I over-interpreted the word choosing.For me
– Mouradif Nov 22 '22 at 15:59xcode-select --installtried to install 20GB worth of data and I don't have the required disk spacepython3 -m http.serveras an example. Before coming to ask this rather straightforward question I was actually trying tobrew install redis. The question was: "s there a way to install command line tools for MacOS without installing the full XCode suite?" (and the title hints: "for Monterey"). – Mouradif Nov 22 '22 at 16:11