Cannot install command line tools due to out of date xcode-select - gcc

For weeks I've been trying to work this out.
When I run bash install_script.sh file as yt-project ( http://yt-project.org/#getyt ) instructs, it outputs this error:
gcc -fPIC -c blocksort.c
make: gcc: No such file or directory
make: *** [blocksort.o] Error 1
I got into contact with someone from the yt-users mailing list who had me check my version of xcode. I ran xcode-select -version and I recieve:
xcode-select version 2003.
This is definitely outdated.
I try to run xcode-select --install to ensure I have CLT, but it only feeds me back the menu of options to input into xcode-select. Nothing occurs.
I installed CLT directly from the developer website, as in Xcode 5.0 and later it is not in Preferences->Downloads. It seemed to install correctly, but it seems that Xcode itself installed incorrectly if I am unable to get a version number higher than 2003.
I tried uninstalling and reinstalling Xcode, but the problems did not change. As per xcode-select --install not running I checked the path on Xcode and it seemed correct. The output of xcodebuild -version is
Error: Can't run /Library/Developer/CommandLineTools/usr/bin/xcodebuild (no such file).
I tried the command listed here Can't install Command Line Tool, "xcode-select --install" doesn't work after confirming that I do not have a /Library/Developer folder.
The path for xcode-select --print-path is
/Library/Developer/CommandLineTools
When I do gcc --version it returns
-bash: gcc: command not found
How do I get the correct xcode-select binary?
I am very amateur at command line and there could be any number of assumptions that are incorrect that I fell into.
Thank you for your help!

Related

How to install OS X 10.12 command line tools on 10.11?

I get this error when trying to brew install geckodriver
==> Installing geckodriver dependency: rust
==> Downloading https://static.rust-lang.org/dist/rustc-1.42.0-src.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/rust/1.42.0 --release-channel=stable
==> make
Last 15 lines from /Users/nilshaus/Library/Logs/Homebrew/rust/02.make:
2020-04-12 21:13:48 -0400
make
make: error: unable to find utility "make", not a developer tool or in PATH
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk" cannot be located.
clang: error: unable to find utility "clang", not a developer tool or in PATH
Do not report this issue to Homebrew/brew or Homebrew/core!
These open issues may also help:
Rust dependents that currently fail to build from source https://github.com/Homebrew/homebrew-core/issues/50815
Error: You are using macOS 10.11.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience while you are running this old version.
Obviously 10.11 is no longer supported by Homebrew. The fact that it can't find make is weird, but I'm willing to bet that the real issue is that the rust build expects the 10.12 command line tools. Is there a way for me to install them on OS X 10.11? I have Xcode 8.
I encountered this same error message when brew upgrade installed a new version of clang and tcl-tk. Found a workaround here:
Xcode was overriding the command line tools install. After moving
Xcode to the trash I found the directory of the command line tools
install:
clang --version
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
/Library/Developer/CommandLineTools/usr/bin
https://github.com/pytorch/pytorch/issues/1139#issuecomment-302967251
Another possible workaround - instead of moving Xcode, choose one of the following to specify CLT version:
sudo xcode-select -s /Library/Developer/CommandLineTools
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
To display the current CLT path: xcode-select -p
https://github.com/pytorch/pytorch/issues/1139#issuecomment-303033942

`xcodebuild` not working from terminal

After I used migration assistant to migrate data from my old mac to a new one I can no longer use Xcode command line tools. Whenever I run any xcodebuild command in terminal (even xcodebuild with no parameters) I get the following error:
dyld: Library not loaded: #rpath/DVTFoundation.framework/Versions/A/DVTFoundation
Referenced from: /usr/bin/xcodebuild
Reason: image not found
Abort trap: 6
When I run which xcodebuild I get /usr/bin/xcodebuild.
When I run xcode-select -p I get /Applications/Xcode.app/Contents/Developer.
Strangely, if I go to /Applications/Xcode.app/Contents/Developer/usr/bin and call ./xcodebuild I do not get the error above.
Here is what I tried:
Installing command line tools using xcode-select --install.
Uninstalling command line tools located in /Library/Developer/CommandLineTools/.
Performing sudo xcode-select --switch /Library/Developer/CommandLineTools/.
Performing sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/.
None of these resolves my problem.
I am running Xcode 9.4.1 and macOS High Sierra 10.13.5.
UPDATE 1
I tried following this guide to uninstall Xcode and all command line build tools completely. The strange thing is, once I followed all the steps, running xcodebuild command produced the same result as before. And xcodebuild was still located in /usr/bin.
UPDATE 2
If I install command line tools using xcode-select --install and go to /Library/Developer/CommandLineTools/usr/bin running xcodebuild from that location does produce the same error. So, running xcodebuild which comes pre-installed with Xcode produces no error, but the one from the command line tools does produce the error. It is puzzling and also suggests that when I try to remove all command line tools, the ones left in my /usr/bin are the ones which do not come with Xcode.
I tried deleting them, but I am unsuccessful even with the sudo command.
UPDATE 3
I've found a workaround. To ensure that xcodebuild command uses the tool located in /Applications/Xcode.app/Contents/Developer/usr/bin rather than the one located in /usr/bin, I added the following line to my .bash_profile:
export PATH="/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH"
This approach works, but my question remains. I do not understand why I had this problem in the first place. I have double checked - my PATH does not contain /Applications/Xcode.app/Contents/Developer/usr/bin on my old Mac and everything works just fine there.
Looks like for some reason, xcodebuild located in /usr/bin got corrupted and couldn't get updated in any way.

Error Message "Xcode alone is not sufficient on Sierra"

I'd like to install openCV to vectorize image, but there's a series error message regarding Xcode and Ruby.
First, I use terminal to install openCV, brew install opencv.
Then, I got error message indicating that the system doesn't like my ruby version.
/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>':
Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)
So, I want to upgrade my ruby. I followed several update strategy from this post. First ruby upgrade trial: brew link --overwrite ruby & brew unlink ruby && brew link ruby and get
Error: No such keg: /usr/local/Cellar/ruby
Then second ruby upgrade trial: brew upgrade ruby and see the following error message.
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
This error message means I need to install Xcode which I already install. So, I check my Xcode status with code-select -p and get /Applications/Xcode.app/Contents/Developer which means I am fine.
I saw a comment regarding where you install python could be a big issue. Quote from the source:
If you see /usr/local/bin/python3 then you are correctly using the Homebrew version of Python. If the output is instead /usr/bin/python3 then you are incorrectly using the system version of Python.
I check which python3 and get
/Users/******/anaconda3/bin/python3
Could this be the problem? How can I change system version to local?
Let me explain this myself so people won't make the same mistakes.
When I saw the last line of the error message
Error: Xcode alone is not sufficient on Sierra.
Install the Command Line Tools:
xcode-select --install
My thought was: I already have Xcode why the system ask me to "reinstall" it. However, thanks for #SamiKuhmonen # Beartech #patrick kuang suggestion, I search a page (in Mandarin). xcode-select --install does not reinstall the whole Xcode. It means install some missing command line tools which is required by installing Ruby.
Trying to install k8s package via brew , I just got the same issue a while ago saying in the terminal :
Error: Xcode alone is not sufficient on Sierra.
Install the Command
Line Tools: xcode-select --install
You need to download *.dmg file; named Command Line Tools (macOS x.x.x) for XCode N . Search on it here : https://developer.apple.com/download/more/ . You must have developer account.
Then, congrats! 🎉
update for 2019
macOS Mojave 10.14.5
Use Xcode10.2 for macOS 10.14
I had the same issue in my Macbook Pro on Sierra. Apart from updating Xcode from the App Store, I also installed the command line utilities using the xcode-select --install command.
After the update steps, brew commands started working fine. I also updating my OS during this time.
I got the same message despite having Xcode and the command line tools already being installed a long time ago and updated numerous times.
I think it is the Apple way of telling you that Xcode command line tools need to be updated, as the App Store showed me the below:
After executing the xcode-select --install command, the update disappears from the App Store, which means they are exactly the same thing.
I had the same problem. I installed 'Command Line Tools for XCode' (choose appropriate version) from https://developer.apple.com/download/more/ and restarted my terminal. Issue resolved :)

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

I'm having xcode issues when I try to use brew and git:
xcrun: error: active developer path ("/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)
I can type xcode-select and it shows that the command exists. When I type xcode-select -p it shows:
/Applications/Xcode.app/Contents/Developer
but when I do which xcode-select, it gives me:
/usr/bin/xcode-select
I've tried to use the command switch and install again via Apple Developer site but none of these options have work so far... How can I fix this?
I tried that and it didn't work but I found the answer. I just had to reset the developer's path:
$ sudo xcode-select --reset
Now everything is normal
Mostly this error occurs when you have installed a newer version of xcode. And the command line tools are yet to be initialized.
To resolve this:
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Please select the Xcode version for tools.
Example (For Xcode 10.0 (10A255) ):
Go under Xcode Preferences > Locations (tab) > And the bottom options is Command Line Tools. Select Xcode 10.0 (10A255).
For more details please see this image:
In my case, I had uninstalled Xcode and then issues with git cli started. I solved the problem running the following commands:
$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
and then validating new path with:
$ sudo xcode-select -p
I have faced the same issue as I have uninstalled the XCode abruptly, running the below command (from Terminal) helped me to resolve this.
sudo xcode-select -switch /
This error coming because xcode get deleted, corrupt or moved.
In my case i removed xcode from my Mac and faced the same issue.
I fixed it by simple two steps
Open Terminal
Simply run following command
sudo xcode-select -r
And now error has resolved. Hope it will helpful.
Use this:
sudo xcode-select -switch /
This should solve the problem.
How about what the error suggests? Did you try that?
xcode-select --switch /Applications/Xcode.app
That should do the trick.
For me it helps to install Xcode CLI
xcode-select --install
after uninstalling XCode (I don't develop for the OSx or iOS)
Then I could successfully build downloaded source with make
Try error suggestion :
sudo xcode-select --switch /Applications/Xcode.app
And Then test Git Executable Path.
I had the same problem and had to remove completely Developer tools, and reinstall:
$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
Tip: because Xcode had been improperly uninstalled, I had to manually (re)move the Xcode app, too:
$ mv /Applications/Xcode.app/ /Applications/Xcode.app.bak
In my case such error occurred after I has tried to symbolicate crash report, and according to a manual, entered command export DEVELOPER_DIR=”/Applications/Xcode.app/Contents/Developer”
I tried some proposed here solutions but nothing helped.
Then I realized that I have added an environment variable DEVELOPER_DIR to my terminal and this led to error: "xcrun: error: missing DEVELOPER_DIR path:"
Then I've just reboot my terminal, that cleaned the environment variable and the error disappeared.
(FYI: environment variables may be checked with printenv command in terminal)
for my mbp m1 apple sillicon for the case alr tried all the above answer and not solved.
i have solved by here discussion https://developer.apple.com/forums/thread/660641
there is have 2 option to solve, my case...
i have uninstalled xcode because i don't need again
install standalone mode, doesnt work. can't install the software
solved by try download manual command line tools check on the discussion thread for the link file ( 741.5 MB ) .

Command Line Tools on OSX 10.9: Installed, but can't show up?

I am trying to install CLT on OSX 10.9 Mavericks.
Before I ask, I referred to these questons:
Failed to install command line tools on OSX Mavericks
Xcode 4.4 and later install Command Line Tools
I installed XCode 5 via the App Store, with the latest version.
Then, as mentioned in all kinds of tutorials, I typed "xcode-select --install" in the bash, however, there weren't any window telling me to install the CLI, but these outputs:
$ xcode-select --install
Usage: xcode-select -print-path
or: xcode-select -switch <xcode_folder_path>
or: xcode-select -version
Arguments:
-print-path Prints the path of the current Xcode folder
-switch <xcode_folder_path> Sets the path for the current Xcode folder
-version Prints xcode-select version information
I tried to run "/System/Library/CoreServices/Install\ Command\ Line\ Developer\ Tools.app" manually, but nothing showed up.
I opened the package, and tried
"sudo /System/Library/CoreServices/Install\ Command\ Line\ Developer\ Tools.app/Contents/MacOS/Install\ Command\ Line\ Developer\ Tools "
And failed like this:
"2013-11-01 19:48:45.060 Install Command Line Developer Tools[42474:507] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x6207, name = 'com.apple.dt.CommandLineTools.installondemand'
See /usr/include/servers/bootstrap_defs.h for the error codes."
I enabled root account and try to run it under root, same output.
Unknown of what that means, I tried "--pkg-info=com.apple.pkg.DeveloperToolsCLI"
It seems that CLI is not working, the outputs are:
"No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'."
I went to Apple 's site, downloaded and installed this file:
command_line_tools_os_x_mavericks_for_xcode__late_october_2013.dmg
Everything goes smoothly, no error reported during the installation.
However, when I try to find the CLI in XCode, it is not there.
Another time "--pkg-info=com.apple.pkg.DeveloperToolsCLI", still "No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.".
Now I am completely puzzled...how can I install this CLI?
Thank you very much in advance.
Make sure that you have updated to the most recent version of Mavericks, then reboot. Run xcode-select --install again. Otherwise, uninstall XCode and reinstall again from App Store.
I called sudo rm -rf /Library/Developer/CommandLineTools and then xcode-select --install.
sw_vers:
ProductName: Mac OS X
ProductVersion: 10.15.2
BuildVersion: 19C57

Resources