How to continue using Git on mac after uninstalling Xcode (with Android Studio)? - xcode

I have installed Git on my Mac. When I do a "whereis" in my terminal the route is:
/usr/bin/git
I use Android Studio and the GitHub desktop client and had no problems so far.
Previously I had installed Xcode, but I uninstalled it a week ago. Since then, Android Studio does not detect Git, I get the following error:
xcrun: error: active developer path
("/Volumes/Vega/Applications/Xcode.app/Contents/Developer") does not
exist, use xcode-select --switch path/to/Xcode.app to specify the
Xcode that you wish to use for command line developer tools (or see
man xcode-select)
Android Studio shows the same executable path to Git
indicating the terminal (/usr/bin/git), but when I click on the "test" button it displays the same error.
I do not handle very well Git from the terminal, always use the desktop client.
What do I have to do to continue using Git on my Android studio (or anywhere) now that I uninstalled Xcode?
I searched for information but I can not fix it.

If commands sudo xcode-select --reset and xcode-select --install does not work for you and you dont want to install xcode then just reinstall git manually via brew:
brew reinstall git
And open new terminal session
Worked for me

sudo xcode-select --reset
Will reset your paths to the defaults if the command line tools are already installed.

You should install the Xcode command line tools at the very least. If you're not a registered Apple Developer, however, I'm not sure how to get hold of them if Xcode is not installed. If you are a registered Apple Developer, you can get them from the Apple Developer Download site. It' probably best to re-install Xcode and you will get them as a system update.
That will give you a minimal development environment, and if you need additional tools/libraries you can build them via Macports with the command line tools installed.

Try this :
xcode-select --install

Related

Installing Xcode command line tools

I performed a fresh install of macOS Mojave 10.14. Immediately after that I installed Xcode Version 10.0 (10A255) from the Mac App Store.
Now, I wish to install Homebrew which requires Xcode command line tools to be installed. My understanding is that installing Xcode also installs the command line tools. Or not?
As per this answer, I checked if the command line tools are installed by running:
xcode-select -p
which printed the path for the Developer directory as follows:
/Applications/Xcode.app/Contents/Developer
As suggested in the answer, I also verified the return value by running:
echo $?
which retuned 0.
I also ran, gcc and make and bash was able to locate and execute them.
Thus far I am convinced that the Xcode command line tools are installed. Now when I execute:
xcode-select --install
I get this alert:
What's the probable reason for this disparity? Will this install Xcode command line tools twice? Or overwrite the existing installation?
As I understand, Xcode command line tools can be installed without installing Xcode. Also, from my previous experience, if the command line tools aren't installed separately from Xcode (by running xcode-select --install), they are not detected by Homebrew, i.e. when running brew config, the value for CLT: is shown as N/A.
Here's the complete picture (pardon the pun):
Although I am talking in context of macOS Mojave, the question remains the same with regard to previous versions of macOS.
What is the advisable approach to take here?
Note: After installing Xcode, I launched it, accepted license agreement and let it finish its run of installing additional tools (which is a one time activity).
Following worked for me, only command line tool can also me installed.
After you updated to Mojave 10.14 Go to https://developer.apple.com/download/more/ search for "command line" then
Download "Command line tool for MacOS 10.14"
Once dmg is downloaded install the package.
Verify package installation

Brew install on Mojave

I did these steps:
Updated to Mojave
Installed Xcode 10 beta3
Ran this command: sudo xcode-select -switch /Applications/Xcode-beta.app/
Now I'm trying to install node8:
brew install node#8
And it gives me this error:
Error: The Command Line Tools header package must be installed on Mojave.
The installer is located at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
Still, doing
install -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
does nothing, since there's no such file in my system. Where could I get it?
Go to /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg location and install package manually. And brew will start working.
I want to try and answer this question and also for those that come later that installed Mojave and had an older Xcode version installed. The process is the same minus that if you have Xcode 10, you don't need to install it again from my understanding.
The folder is hidden and was not accessible even with a sudo find command, however, I figured out that copying the absolute path and then pasting it in your browser address bar will give you the download and access to the folder that you need to fix brew install.
I posted a video here- https://youtu.be/GfnhSirTCGM that walks you thru part of my steps above. After you do the SDK headers download, its likely that unless you already are running Xcode 9.4, you will need to visit, https://developer.apple.com/download/more/ and look for Xcode 9.4 to install. Also grab the 10.14 command line tools as well. The lesson that should be learned here is that Apple calls it "Beta" for a reason and if you are a developer that knows the pains of setup, it is a bad idea. I hope that I was helpful! The last thing is, INSTALL XCODE THEN COMMAND LINE TOOLS-IN THAT ORDER OR IT ERRORS OUT! and then we do this all over again. Cheers!
It appears as though Apple has released a patch for the bug and it is available through the system preferences. 14 July 2018
Broken command line tools:
Xcode Location on the Apple developers website:
Location of command line tools:
Do not install Xcode from the Mac App Store because a different version is required!
Command line tools 10.14 update:
As of October 2018, the solution for making brew and brew install succeed is to:
install latest Xcode fom AppStore
run Xcode and install command line tools
add the line before to your profile or somethign similar
export CFLAGS="-I/usr/local/include -L/usr/local/lib -I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include"
No need to download Xcode manually, but you may want to remove the beta version if you installed it.
The magic part is at the end, where xcrun obtains the correct location of the SDK.
In terminal, you should first input the commands below
cd /Library/Developer/CommandLineTools/Packages
open .
you will open the directory on desktop,
then double click the pkg file to install it.

How to install xcode 8 from terminal in vagrant?

Having a running vagrant instance of macosx 10-12, when running
xcode-select --install
I get:
xcode-select: note: install requested for command line developer tools.
But the problem is nothing pops up and it finishes on that. What should I do in this case? I also cannot download the xcode 8 package manually from the store as only install option is present and there is no gui in vagrant
I suggest you to download .xip file of xcode and install it. Below is the link to download xcode or anyother development tool for apple developer.
https://developer.apple.com/download/more/

Xcode installing on mac

I am new to mac and I want to install Xcode. I have macOS Sierra Version 10.12.2. I found online that I have to run in terminal:
xcode-select --install
I did that but I get this:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
However, I can't find it in Application folder or with Spotlight Search and there is no Software Update to be done. Also, I found online that I have to download it from App Store and I am a bit confused. I can install it from terminal (and if so, why is it not working) or I have to download it from App Store?
Thank you!
xcode-select: error: command line tools are already installed, use
"Software Update" to install updates
It shows that your operating system has already installed xcode-select.
Finding your xcode-select. Go to Terminal and type
xcode-select --print-path
It shall return the location of your xcode-select to you:
/Library/Developer/CommandLineTools
Xcode: develop an app for Apple products
xcode-select: command-line tool
Depending on what you want to do with Xcode, xcode-select is way smaller than it, 8.1GB vs. nothing.
2018 and I had the same issue. Installing XCODE from the App Store did not resolve this.
I Had to download the command line tools for my XCODE and Apple Version.
https://developer.apple.com/download/more/
Searched for XCODE on that page above and picked the right version for me.
After installation of the DMG I could continue with Brew Installation.
You don't install Xcode from terminal, you have to go to develloper.apple.com in order to download the latest versions. Here's the link to save you some time:
Link to Xcode
Plus the version available depends on what Mac Osx version you have.
Was having the same issue after some system update, cannot even run things like make install.
verify your path by xcode-select --print-path, which might be /Applications/Xcode.app/Contents/Developer(need to be updated at last)
go to apple develper site, login, search command line tools, download the latest dmg, install. (better option than the 10+GB Xcode)
now update the path in step 1 by running sudo xcode-select --switch /Library/Developer/CommandLineTools.
verify again by running the xcode-select --print-path.
Now it should be good to go.

Git and Github Mac App incompatibilities?

After I've installed Github Mac app on my macbook (running OSX Mavericks 10.9.2), I've tried to type git on the terminal, and a message appears and say:
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.
I've also already installed the "Command Line Tools" from Github Mac app preferences.
So, what is the problem?
Why I can not use the "git" terminal commands and Github Mac client app together?
I've search over the web for solutions, but anyone resolves my problem.
Try running xcode-select --install.
As far as I understand, the command line tools are compilers and other tools needed for development.
For background: prior to Xcode 5, you used to have to download Xcode and within Xcode's preferences choose 'Install Command Line Tools' (or use the command I listed above).
Edit: Corrects the install flag syntax

Resources