I upgraded to xcode 5 Command Line Tools on Friday. Something is not working correctly and I want to go back to the last 4.x version ox xcode. How do I uninstall xcode 5 command line tools? I don't see anything in the release notes.
-
1I ended up restoring a time machine backup. Everything was going wonky on my machine (RVM, xcode CLI, bundler) and after the restore, everything was much better. I must've messed something up badly. I would still like to know the answer to this question in case it comes up in the future. – WattsInABox Jan 11 '14 at 14:42
-
Sorry, but I could not understand what you want exactly. Do you want to uninstall Xcode 5 and install a previous version? Or do you want to uninstall only the command line tools, keeping Xcode 5 with an older version of the command line tools? – veducm Jan 12 '14 at 22:52
-
http://stackoverflow.com/questions/14756026/how-to-downgrade-xcode-to-previous-version – Dmitriy.Net Jan 13 '14 at 06:36
-
@PICyourBrain Did any of the answers actually help you? Did you find any other solution? – veducm Jan 23 '14 at 10:07
3 Answers
Depending on whether you are running Xcode 5 in Mavericks or not, you will need to do two different things to uninstall the command line tools.
In Mavericks, Xcode includes its own copy of the Command line tools (i.e. they are bundled as part of Xcode.app). Therefore, uninstalling the Xcode (check instructions below) will remove the Command line tools too.
For older Mac OSX versions running Xcode 5 or older versions (Xcode 4.x), you can find previous SO answers which explain how to uninstall Xcode's command line tool. You can use this script (Read more about it in this post):
# remove_CLI_tools.sh # written by cocoanetics:http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/ # modified by yoneken #!/bin/sh RECEIPT_FILE1=/var/db/receipts/com.apple.pkg.DevSDK.bom RECEIPT_PLIST1=/var/db/receipts/com.apple.pkg.DevSDK.plist RECEIPT_FILE2=/var/db/receipts/com.apple.pkg.clang.bom RECEIPT_PLIST2=/var/db/receipts/com.apple.pkg.clang.plist RECEIPT_FILE3=/var/db/receipts/com.apple.pkg.llvm-gcc4.2.bom RECEIPT_PLIST3=/var/db/receipts/com.apple.pkg.llvm-gcc4.2.plist RECEIPT_FILE4=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom RECEIPT_PLIST4=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist if [ ! -f "$RECEIPT_FILE4" ] then echo "Command Line Tools not installed." exit 1 fi echo "Command Line Tools installed, removing ..." # Need to be at root cd / # Remove files and dirs mentioned in the "Bill of Materials" (BOM) lsbom -fls $RECEIPT_FILE1 $RECEIPT_FILE2 $RECEIPT_FILE3 $RECEIPT_FILE4 | sudo xargs -I{} rm -r "{}" # remove the receipt sudo rm $RECEIPT_FILE1 $RECEIPT_FILE2 $RECEIPT_FILE3 $RECEIPT_FILE4 # remove the plist sudo rm $RECEIPT_PLIST1 $RECEIPT_PLIST2 $RECEIPT_PLIST3 $RECEIPT_PLIST4 echo "Done! Please restart XCode to have Command Line Tools appear as uninstalled."
You can run this easily by opening a Terminal and running this command (it will download the script and execute it automatically):
curl "https://gist.github.com/yoneken/3284561/raw/db665bb64f93e38ce138b5ca620b9edd18dc31e4/remove_CLI_tools.sh" | sh
If everything worked fine, you could open Xcode and see that the Command Line Tools appear as to be installed.
Then, depending on what you want, you could downgrade Xcode to a lower version and reinstall the Command Line Tools for that version, for example.
To downgrade Xcode, as explained in this SO answer:
- Uninstall Xcode 5: go to
/Applications
and delete the Xcode app. - Restart the Mac.
- Then you can download the desired Xcode version from here and install it from scratch.
-
Thanks for the answer but that script doesn't work for XCode 5, as I understand it. It is for the 4.3 CLI – WattsInABox Jan 13 '14 at 18:50
-
1After some more research, I found that with **Xcode 5.0.x and Mavericks**, Apple has gone back to **bundling the Xcode command line tools for into Xcode.app** (+info: http://derflounder.wordpress.com/2013/11/15/xcode-command-line-tools-included-with-xcode-5-0-x-on-mavericks/). Therefore, unless you installed the Command line tools manually, uninstalling the app should remove the Command Line Tools too. – veducm Jan 13 '14 at 23:58
-
@WattsInABox Did my last research help you at all? I would like to verify that the answer is correct for your specific situation too. – veducm Jan 22 '14 at 10:56
-
That sounds very helpful so I gave you a +1. I don't actually need this right now b/c I worked around the problem, but it's a good tip. Thanks! – WattsInABox Jan 23 '14 at 04:39
-
@veducm this is not the case with me on mountain line. still running gcc shows clang – Mohamed El-Nakeep Jan 23 '14 at 19:01
-
@MuhammadAnnaqeeb How did you installed the Command Line Tools. Remember that in Mavericks, they come packaged with Xcode 5, but you can still install them separately. In case you install them manually or with an older version of Xcode, they won't get uninstalled automatically with Xcode, so you will need to uninstall them manually. – veducm Jan 23 '14 at 21:35
-
I installed it on mountain Lion from Xcode 5.0.2 Prefernce ->Downloads Tab , as described in http://apple.stackexchange.com/questions/57974/cant-install-xcode-command-line-tools-on-mountain-lion when i removed Xcode 5 and restarted the mac they were not gone. if i run gcc in console, i get clang saying there is no input file. I had to run a script from http://superuser.com/questions/638258/how-do-i-completely-uninstall-the-os-x-developer-tools to remove the command line tools. I wrote the script in the answer below. – Mohamed El-Nakeep Jan 23 '14 at 22:40
-
@MuhammadAnnaqeeb So in your case (Xcode 5 in an older version of MacOS), that would be the second scenario stated in my answer, the given script did not work for you? Did you get any errors when running it? Because the script in your answer looks very similar to the one proposed in this answer for your situation, doesn't it? – veducm Jan 28 '14 at 15:08
-
The url has changed: https://gist.githubusercontent.com/yoneken/3284561/raw/db665bb64f93e38ce138b5ca620b9edd18dc31e4/remove_CLI_tools.sh – Nick Desaulniers Jul 24 '14 at 21:34
I stumbled upon this while trying to uninstall Command Line Tools v6.
I had the full Xcode 6 installed, but moving Xcode to trash did NOT uninstall/delete CLT as well. I still had /usr/bin/clang
for example. The solution was to manually remove CLT using the .bom contents (similar to @veducm's answer):
cd /
lsbom -fls /var/db/receipts/com.apple.pkg.CLTools_Executables.bom | sudo xargs -I{} rm -rf "{}"
lsbom -fls /var/db/receipts/com.apple.pkg.DevSDK_OSX109.bom | sudo xargs -I{} rm -rf "{}"
sudo rm /var/db/receipts/com.apple.pkg.{CLTools_Executables,DevSDK_OSX109}.{bom,plist}
Replace DevSDK_OSX109
with the version you have. You may have multiple ones, in which case, apply the same command to all of them (e.g. I had both DevSDK_OSX109
and DevSDK_OSX1010
because I had installed CLT for Mavericks and Yosemite too).
NOTE: This will delete the files listed in the .bom. You can view the contents them first by doing just lsbom -fls /var/db/receipts/com.apple.pkg.CLTools_Executables.bom
etc if you are unsure.
NOTE2: You need the cd /
since paths reported by lsbom are relative. You can also remove CLT by simply doing rm -rf /Library/Developer/CommandLineTools
.

- 1,156
- 12
- 22
The rm command removes (deletes) files or directories.
Delete CLT from following command
sudo rm -rf /Library/Developer/CommandLineTools
from terminal.

- 6,557
- 5
- 33
- 51