8

I have deleted the Xcode Command Line Tools from my machine by essentially removing the folder. However, AppStore still shows updates from the CLI tools, which obviously I don't want.

I've been trying to properly understand where AppStore looks to figure out what needs updating, but I haven't been able to find a certain answer yet. I tried editing the updatejournal file, but that didn't help, so I've since restored it.

I started to suspect that the fact that pkgutil shows some CLTools-packages might be the cause of this. Forgetting them does not work however as the bom are neither in /var/db/receipts or /Library/Receipts (the pkgutil --forget essentially fails because of this).

I did however find them after a lot of searching in /System/Library/Receipts. Those I can't delete though due to the system security. I can of course bypass that and delete them to see if it works, but I don't want to do that "just to see".

I would like to find a proper solution to this.

Any ideas what I should do here?

| improve this question | | | | |
  • 1
    Not quite, as I wrote in the top I have deleted the folder, but it seems another commenter on that question has the same problem as me. – Kenny Lövrin Jun 18 '18 at 9:19
  • Thanks for the answer here. Iā€™m linking to it since others will have the same problem. +1 here and on the answer of course – bmike Sep 27 '18 at 11:08
7

I managed to fix it, it seems like I suspected, the problem was the boms in the /System/Library/Receiptsfolder.

So I booted into recovery mode, disable SIP, moved all files from that folder that had com.apple.pkg.CLTools*in their name, and the update in the App Store went away. Then I booted into recovery again to enable SIP.

It doesn't feel quite right to disable the security, but I gave it a try in this case as other similar problems seemed to be related to lingering bom files, so perhaps it makes sense.

| improve this answer | | | | |
  • This file does not exist on any of the 100 Macs I checked at work this morning that all used App Store to get this package - what was the date / time of your receipt? I wonder if it was left over from an old (non CLI) install or a beta build of OS or the dev tools. – bmike Jun 18 '18 at 13:08
  • To be honest my memory isn't totally fresh. I do have the files in my Trash still and they have a creation of Nov 17th 2017. I seem to remember having this problem because I was running a beta of High Sierra and Homebrew wouldn't work properly without the CLI-tools even though I had Xcode installed (I haven had to install both CLI and Xcode in parallell for years), so I had to install them manually. But High Sierra was released in November wasn't it? Anyway, just thinking out loud here, can't actually remember for sure. – Kenny Lövrin Jun 18 '18 at 13:13
  • Also, what do you refer to with "using app store to get this package"? It doesn't exist in the App Store by itself, you have to either install it with xcode-select or download it from the dev portal (perhaps from inside Xcode is also possible, can't remember that specifically). – Kenny Lövrin Jun 18 '18 at 13:15
  • This worked. An alternative to disabling SIP, you could also boot from an external drive and then remove files from /System using that OS. – adib Jul 29 '18 at 13:46
  • 1
    @KennyLövrin No need to disable SIP ā€“ remove the receipt files using the Terminal app also available in the recovery OS. – adib Nov 18 '18 at 10:51
2

Delete this folder and your headache's will be gone forever:

/Library/Developer/CommandLineTools

| improve this answer | | | | |
  • 3
    The very first line of my question states that I have deleted the folder. – Kenny Lövrin Jun 18 '18 at 8:58
  • To be fair @KennyLövrin you didn't mention the name of the folder so Vighnesh is correct. An edit to your post about precisely which folder was removed would reduce reports like this one that provide details. – bmike Sep 25 '18 at 11:44
  • I don't think it's fair to say Vighnesh is correct, since Kenny is actually correct, in stating that "the folder" was deleted, but Vighnesh's comment is actually incorrect, and a careful reading of the question and the title would have revealed that this was nothing to do with uninstalling CLT themselves. I think Vighnesh needs to bear some responsibility for actually considering questions carefully before rushing ahead with basic answers to a question that was not actually asked. Sure name the folder precisely, by all means, but the actual fault here is with Vighnesh. – NeilG Jun 26 '19 at 1:33
2

My reinstalled macOS Mojave had exactly the same problem. I installed Xcode and CLT both, then 6 or 7 CLT updates come out from System Update, suggesting me to install old version CLTs.

I then removed this folder /Library/Developer/CommandLineTools, reboot, all the updates are gone.

I didn't remove the receipt things.

| improve this answer | | | | |
2

There are 2 steps for clean removal

  1. Delete /Library/Developer/CommandLineTools directory (as mentioned above).
  2. Reset to default command line tools by running

xcode-select -r

Explanation: When command line tools are installed, the path for command line tools is set to "/Library/Developer/CommandLineTools". This can be checked by running

xcode-select -p

Even if we remove the directory, system would go and check there. Once you reset the path and run xcode-select -p, it gives an error

xcode-select: error: unable to get active developer directory, use sudo xcode-select --switch path/to/Xcode.app to set one (or see man xcode-select) This would bring it to the initial state.

Running any command, say "python3 --version" without resetting the path would give:

error: tool 'python3' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

and once you reset the path, it will will prompt to install command line tools along with :

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

| improve this answer | | | | |

You must log in to answer this question.

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