Manual Install of Xcode command line tools not wor

2019-08-08 22:54发布

问题:

I've manually installed the Xcode command line tools from the Apple website, and I went through the install process but it doesn't seem to be working. I ran this from the terminal to see if it installed:

Zach-Boyette-MacBook-Pro-2:~ zachboyette$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.1.0.0.1.1396320587
volume: /
location: /
install-time: 1398301024
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group  com.apple.DevToolsNonRelocatableShared.pkg-group 

So it looks like the command line tools have installed, but when I run this:

Zach-Boyette-MacBook-Pro-2:~ zachboyette$ xcode-select --install

A popup says: The "xcode-select" command requires the command line developer tools. Would you like to install the tools now?

I clicked install and then it said: Can't install the software because it is not currently available from the Software Update server.

I've read on other answers that the solution is to do a manual install, but I just did that so I don't understand why it's not working. Also, in Xcode downloads, it's not showing the Command Line Tools.

I've tried installing it manually many times so I don't know why it's not working.

Installing Jekyll still won't work:

Zach-Boyette-MacBook-Pro-2:~ zachboyette$ sudo gem install jekyll
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
ERROR: Failed to build gem native extension.
EDIT: echo $PATH returns this:

Zach-Boyette-MacBook-Pro-2:~ zachboyette$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/zachboyette/.rvm/bin

回答1:

Command Line Tools are not included in XCode 5.1.1 You have to install it manually, BUT DON'T USE "xcode-select --install". It does not work.

  1. Open Xcode app.
  2. Click on Xcode > Open Developer Tools > More Developers Tools. That will take you to Downloads for Apple Developers web site. Use your AppStore Id to login.
  3. Download Command Line Tools for your Mac OS X version.


回答2:

I have stumbled across this issue before when I completely hosed my development environment by deleting an ancient Xcode version.

Have you tried running sudo xcode-select -r to clean up? This sorted my problem.

From the man page:

-r, --reset
              Unsets  any  user-specified  developer  directory,  so  that the
              developer directory will be found via the default search  mecha-
              nism.  This  command must be run with superuser permissions (see
              sudo(8)), and will affect all users on the system.


回答3:

The easiest work around is to install the XCode app from the App Store then open XCode and agree to the Terms and Conditions.

From there the Command Line Developer Tools package can be installed on using xcode-select --install or by trying to use any command line developer tool in Terminal like git.