17

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?

3
  • Dupe? apple.stackexchange.com/questions/308943/…
    – bmike
    Jun 17, 2018 at 21:24
  • 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. Jun 18, 2018 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, 2018 at 11:08

10 Answers 10

9

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.

7
  • 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, 2018 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. Jun 18, 2018 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). Jun 18, 2018 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, 2018 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, 2018 at 10:51
9

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.

1
  • 1
    This seems like the most appropriate answer given it doesn't require disabling SIP.
    – Doug
    Jan 28, 2021 at 15:03
5

I just spent hours on this exact issue and FINALLY FIGURED IT OUT, for anyone reading this in the future.

Deleting /Library/Developer/CommandLineTools didn't work.

xcode-select -r didn't work.

There were no receipts or boms in the usual places (/var/db/receipts, /Library/Receipts, and /System/Library/Receipts).

Know what it was? The receipts were in /Library/Apple/System/Library/Receipts. Removed everything with CLTools or SDK in the name and the system update for the CLT disappeared. THANK THE LORD. Not sure if SIP needed to be disabled for this or not (I had it disabled).

2
  • I should test this on my Monterey system before I take the plunge to Ventura
    – bmike
    Jun 9, 2022 at 9:16
  • what is the CLTools ? can you more describe with specify step by step ? please help me Feb 19 at 15:15
4

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

/Library/Developer/CommandLineTools

3
  • 5
    The very first line of my question states that I have deleted the folder. Jun 18, 2018 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, 2018 at 11:44
  • 1
    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, 2019 at 1:33
3

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.

1
3

Thanks Alex, this was exactly the information I needed.

On a fairly recent Mac setup (Apple Silicon chip, macOS 12.0 Monterey Beta), having installed the Command Line Tools then uninstalled them by deleting /Library/Developer/CommandLineTools and running sudo xcode-select -r, I was still getting updates to the tools in System Preferences > Software Update.

Indeed, the receipts are at /Library/Apple/System/Library/Receipts, in the form of files

com.apple.pkg.CLTools_Executables.{bom,plist}
com.apple.pkg.CLTools_SDK_macOS*.{bom,plist}
com.apple.pkg.CLTools_macOS_SDK.{bom,plist}

They are protected by SIP: to delete them, I had to disable SIP first (ie disable SIP, delete the files, re-enable SIP).

1

Upon testing on macOS 12.4, Software Update in System Preferences has the plist and bom stored in /Library/Apple/System as installer pacakges volume. The process to remove them:

  1. disable SIP
  2. Run the following command line
  3. enable SIP

the command line:

Vol="/Library/Apple/System"; if [ "$(csrutil status | awk -F': ' '{print $2}')" = "disabled." ]; then /usr/sbin/pkgutil --pkgs="com.apple.pkg.CLTools_.*" --volume "$Vol" | while read -r pkg; do sudo /usr/sbin/pkgutil --forget "$pkg" --volume "$Vol"; done; else echo "After disbale SIP, run this command again, and then enable SIP."; fi

simple explain: if SIP is disabled, it reads all com.apple.pkg.CLTools_* package ID and remove them one by one by assign volume path to "/Library/Apple/System".

0

Following on what TonyL. shared, you can currently (as of macOS Ventura) forget any package by:

  1. Temporarily disable SIP
  2. Run sudo pkgutil --forget _ANY_PACKAGE --volume "/Library/Apple/System"
  3. Enable SIP
0

Followed suggestion by @Alex user:429648 above, and that worked perfectly for me to stop system notifications to update Xcode Command Line Tools.

The one additional thing needed to do was to disable SIP first, then follow Alex's simple steps.

2
  • 1
    Your answer is a duplicate of existing answers. If you found another answer useful, then upvote it. "This worked for me too" answers are not a good fit for this site. Sep 18 at 23:07
  • It's not a duplicate—it includes additional information about SIP. Great that you want to monitor everything so tightly, yet your recommendation to upvote—which is what I wanted to do—is not possible because I don't have enough numbers associated with my account. Sep 20 at 0:07
-2
  • Remove
    sudo rm -rf /Library/Developer/CommandLineTools
    
  • If needed install again
    sudo xcode-select --install
    
4
  • 1
    This is in several other answers and most of them have more information. What makes your answer a good one for this site?
    – mmmmmm
    Oct 28, 2022 at 17:01
  • Hey @mmmmmm giving the possibility of triple click to copy paste entire line make my answer straightforward and different than the others
    – Ax_
    Jan 13 at 12:28
  • So edit the answer that does not make it clear. to add the ease of use.
    – mmmmmm
    Jan 13 at 12:39
  • Good connoisseur few words
    – Ax_
    Jan 14 at 3:20

You must log in to answer this question.

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