xcode-select –install
removed XCODE APP

RESOURCES

  • INSTALL XCODE
  • Download from: https://developer.apple.com/downloads/index.action
  • Catalina – v11.5 is latest
    • Resetting Path
    • sudo xcode-select –reset
    • the above is the only thing that straightened out the path issue once it was installed
    • after running sudo xcode-select –reset
    • The developer’s path was finally corrected/reset
    • xcode-select –print-path
    • /Library/Developer/CommandLineTools
    • Could have left XCode installed – lol


INFO

https://faun.pub/macos-catalina-xcode-homebrew-gems-developer-headaches-cf7b1edf10b7

Errors and problems

After upgrading to Catalina, I’ve run into three types of issues: Xcode, Homebrew, and Ruby/Gems-related. If you use Xcode, I recommend fixing Xcode first. Many developer tools on Macs rely on Xcode behind the scenes.

While these issues will mostly affect developers, the fixes might help others as well.

Xcode Errors

With the Catalina upgrade, my Xcode did not automatically update to 11.1. The App Store kept trying to update Xcode each night through automatic updates. On its own, it never succeeded. Once it reported it could not download Xcode:

Unable to Download App. "Xcode" could not be installed. Please try again later.

Most of the time, my Mac simply reported failure:

Unable to Install Update.

When I tried to run a tool that relies on Xcode, the Mac gave this xcrun error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun.

Xcode Fixes

The type of Xcode fix you’ll need depends on the answer to one big question: do you use full Xcode? Most developers will probably have the whole enchilada. You can check by going to Finder, then Applications, and look for “Xcode.app.” If you see that, you’re using full Xcode.

If you’re just using the Xcode command-line tools (less than 200 MB) versus full Xcode (about 16 gigabytes when extracted), you can save a lot of download time.

To fix Xcode command-line tools, also known as xcode-selectbut not Xcode — it’s confusing I know — try this command:

xcode-select --install

If that doesn’t fix the issue, restart and try a reset:

xcode-select --reset

Most developers will need all of Xcode. The best way to fix Xcode is to download and install Xcode yourself rather than relying on the App Store or automatic updates. Prepare yourself because you’re going to need nearly 30 GB of free space, an Apple Developer account, and a fast connection to download over 7 GB.

This is the process to fix/upgrade Xcode:

  1. Go to the Apple Developer site and login
  2. From the More Software section, click on Xcode 11.4 (or 11.5 when it comes out) and download the Xcode 11.1.xip file. You are fine to save it to the Downloads folder.
  3. Once the XIP is downloaded, double click to begin extracting Xcode. Follow the prompts and accept the terms (assuming that in fact that you, of your own free will, and on the advice of counsel, do accept the terms).
  4. Once extracted, drag the Xcode.app to the Applications folder (often shown under Favorites). When asked, answer that you want to replace the existing and older Xcode.

Once you complete this process, your App Store should soon stop being a politician — begging to perform a task it can’t complete.


Download Manually

https://developer.apple.com/download/more/

To install the necessary Xcode tools from the Web:

You can download the Xcode command line tools directly from the developer portal as a .dmg file.

  1. On the Mac, go to https://developer.apple.com/downloads/index.action
    You are asked for your Apple Developer login during the install process.
  2. On the “Downloads for Apple Developers” list, select the Command Line Tools entry that you want.

What you are actually using is the command to install the Xcode command line tools – xcode-select --install. Hence the error message you got – the tools are already installed.

The command you need to update Xcode is softwareupdate command [args ...]. You can use softwareupdate --list to see what’s available and then softwareupdate --install -a to install all updates or softwareupdate --install <product name> to install just the Xcode update (if available). You can get the name from the list command.

As it was mentioned in the comments here is the man page for the softwareupdate tool.

2019 Update

A lot of users are experiencing problems where softwareupdate --install -a will in fact not update to the newest version of Xcode. The cause for this is more than likely a pending macOS update (as @brianlmerritt pointed out below). In most cases updating macOS first will solve the problem and allow Xcode to be updated as well.

Updating the Xcode Command Line Tools

A large portion of users are landing on this answer in an attempt to update the Xcode Command Line Tools. The easiest way to achieve this is by removing the old version of the tools, and installing the new one.

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

A popup will appear and guide you through the rest of the process.


 

find where it was installed

xcode-select –print-path
/Applications/Xcode.app/Contents/Developer

fix error

xcrun: error: active developer path (“/Applications/Xcode.app/Contents/Developer”) does not exist
Use `sudo xcode-select –switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools


sudo it

sudo xcode-select –switch /Applications/Xcode.app/Contents/Developer

nope

xcode-select: error: invalid developer directory ‘/Applications/Xcode.app/Contents/Developer’


check zshrc – not there

My issue here was that I was setting the DEVELOPER_DIR environment variable in my ~/.bash_profile like so:

export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

Removing this and restarting fixed my xcode-select issue. I can now switch to the beta install of Xcode and hit the beta version of xcodebuild.

 


https://wilsonmar.github.io/xcode/

 

 

About Xcode

PROTIP: Skip Apple’s websites and App. Click here for install instructions (below).

Otherwise, read on for a run-around.

  1. Use an internet browser to view Apple’s Xcode marketing page at:https://developer.apple.com/XcodeXcode “includes everything you need to create amazing apps for all Apple platforms. Now Xcode and Instruments look great in the new Dark Mode on macOS Mojave. The source code editor lets you transform or refactor code more easily, see source control changes alongside the related line, and quickly get details on upstream code differences. You can build your own instrument with custom visualization and data analysis. Swift compiles software more quickly, helps you deliver faster apps, and generates even smaller binaries. Test suites complete many times faster, working with a team is simpler and more secure, and much more.”.BTW the “Apple platforms” include MacOS, iPhone, iPad, Apple TV, and Apple Watch.

Xcode does not come with macOS because of its large size and because many users of macOS don’t need it to do software development.

Developers who use another IDE (such as Visual Studio, Eclipse, etc.) would only need to install Xcode’s command line utilities for the GCC compiler Python needs to build code.

PROTIP: Newer versions of Xcode installer also installs a Git client.


Overlapping installers

Imagine a Venn diagram of overlapping circles:

  1. The Xcode IDE, which can be installed on a Terminal command line interface (CLI) or
  2. downloaded as a package from the App Store.

Either way, Xcode contains:

  1. Command Line Utilities which can be installed separately on a Terminal command line session.

PROTIP: Xcode IDE cannot be installed if Command Utilities has already been installed.

However, you can switch:

sudo xcode-select –switch /Applications/Xcode.app

So choose which one you want installed.

What Has Been Installed?

  1. In a Terminal window, find out what has been installed:xcode-select -p That’s the same command as:xcode-select –print-pathIf the Xcode-select command is not found, choose to either install Command Line Tools or install the full Xcode IDE.You have Command Line Tools installed and not the full Xcode if you see the path where CommandLineTools are installed:
    /Library/Developer/CommandLineTools

    If all you need is Command Line Tools, you’re good to go.

    Alternately, if the full Xcode was installed, you would instead see:

    /Applications/Xcode.app/Contents/Developer
    
    /Applications/Xcode8.3.3/Xcode.app/Contents/Developer
  2. Get a list of its folders if Xcode IDE was installed:ls /Applications/Xcode.appThe response would be:
    Applications Library      Makefiles    Platforms    Toolchains   Tools        usr

    xcode-select –install

    Delete first

  3. PROTIP: If you want the full Xcode IDE when you have the Command Line Tools installed, first uninstall Command Line Tools, then install the full Xcode IDE.

    More version information

    Xcode Version

  4. From within a Terminal, type:/usr/bin/Xcodebuild -version If Command Line Tools was installed, you would see:
    Xcode-select: error: tool 'Xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    If Xcode is installed, you would get a version code that should match up with the Build Number on the Apple web page:

    Xcode 10.2.1
    Build version 10E1001
    
  5. For a more precise version number and other info (macOS Mavericks version and up):pkgutil –pkg-info=com.apple.pkg.CLTools_Executables A sample response, at time of writing:
    package-id: com.apple.pkg.CLTools_Executables
    version: 11.5.0.0.1.1588476445
    volume: /
    location: /
    install-time: 1590584803
    groups: com.apple.FindSystemFiles.pkg-group
    

    The previous command was constructed based on a search of tools package names:

    pkgutil --pkgs | grep -i tools
    

    The response:

    com.apple.pkg.CLTools_Executables
    com.apple.pkg.CLTools_SDK_macOS1015
    com.apple.pkg.CLTools_SDK_macOS1014
    com.apple.pkg.CLTools_macOS_SDK
    
  6. Get the version of GCC installed:gcc –versionIf Xcode was installed, you would see (at time of writing):
    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
    Apple clang version 12.0.0 (clang-1200.0.32.2)
    Target: x86_64-apple-darwin19.6.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
    

    Previously, it was instead:

    Apple LLVM version 10.0.1 (clang-1001.0.46.4)
    InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

    If Command Line Utilities is installed, you would see (at time of writing):

    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
    Apple clang version 11.0.3 (clang-1103.0.32.62)
    Target: x86_64-apple-darwin19.4.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
    
  7. Identify the path where the make utility Java uses:xcrun –find gcca. If Xcode is installed, the response is:
    /Applications/Xcode.app/Contents/Developer/usr/bin/make

    b. If Command Line Utilities is installed, the response is:

    /Library/Developer/CommandLineTools/usr/bin/gcc

    c. If no Xcode is installed:

    xcrun: error: active developer path ("/Library/Developer/CommandLineTools") does not exist
    Use `sudo Xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `Xcode-select --install` to install the standalone command line developer tools.
    See `man Xcode-select` for more details.
    

    Swift version

  8. Get the version of the Swift program used to develop iOS mobile apps:swift -versionSample response at time of this writing:
    Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
    Target: x86_64-apple-darwin19.6.0
    

    If jamf installed Xcode, you’ll also see:

    [1]+  Done                    sudo rm -rf /Library/Developer/CommandLineToolsjamfselfservice://content?entity=policy

    The above appears regardless of whether Command Line Utilities or Xcode is installed.

    From here, uninstall and install Command Line Tools or install the full Xcode IDE.

    UnInstall Command Line Tools

    PROTIP: This is also how you upgrade Command Line Tools.

  9. Go to the parent folder where Command Line Tools is installed:cd /Library/Developer
  10. Get a list of its folders:ls CommandLineTools If Command Line Tools were installed, the response would be :
    Library	SDKs	usr
  11. Remove all files in that folder, which requires a password for elevated permissions to get all the files:sudo rm -rf /Library/Developer/CommandLineTools The response is a lot of files removed (to the Trash).Now you can choose to either 

    Install Command Line Utilities only

    See https://developer.apple.com/library/archive/technotes/tn2339/_index.html and http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x

  12. To install the whole Xcode IDE:xcode-select –installYou should see this pop up:
  13. Manually click “Install”, “Agree”, then “Install” to the “Updates Available” pop-up.NOTE: The xGB download takes 13 minutes on a 10mbps line.
  14. When you see “The software was installed.”, click “Done” to dismiss the pop-up.

Xcode IDE install from Terminal

  1. Make sure you have at least 13GB free on your hard-drive before attempting installation.
    1. Click the Apple icon to select “About this Mac”.
    2. Click “Storage” tab.
  2. In an internet browser, get to the “Mac App Store Preview” for Xcode at
  3. Click View in Mac App Store, then “Open App Store.app” in the pop-up.
  4. Provide your Apple ID and password. Get one if you don’t already have one.PROTIP: DO NOT install a beta version of Xcode.The blue “OPEN” icon appears at the upper-right when the app is installed. But don’t click it because we are done.
  5. In Finder, look for Xcode.app in the /Applications folder.Alternately, on the Touchpad pinch 4 fingers together to click the App Store. Type enough of “Xcode” to filter out others.
  6. To view the version, cursor to the top of the screen and click the program name next to the Apple icon to select “About Xcode”:

A) Initial install from Terminal CLI

  1. Open a Terminal.app console window at any directory to install -all the latest Xcode from Apple:softwareupdate –install -a The response on Catalina version of macOS:
    Software Update Tool
     
    Finding available software
     
    Downloaded macOS Catalina 10.15.5 Update
    Installing macOS Catalina 10.15.5 Update
    Done.
    To install these updates, your computer must shut down. Your computer will automatically start up to finish installation.
    Installation will not complete successfully if you choose to restart your computer instead of shutting down.
    Please call halt(8) or select Shut Down from the Apple menu. To automate the shutdown process with softwareupdate(8), use --restart.
    
  2. Click the Apple icon at the upper-right corner and select “Shut Down…”.

    After starting again

  3. Set Apple’s licensing agreement bit:sudo xcodebuild -license
  4. Manually agree to the terms.
  5. Get the version number of the new version.

 

B) Initial IDE install using web App Store

  1. In an internet browser, https://developer.apple.com/download
  2. Sign in to Apple Developer with your email address then click the arrow icon. Enter your password, then click the arrow icon.Below is the “Software Update” approach:You’ll need to establish an Apple ID if you haven’t already.
  3. Click the cloud icon Download and provide your Apple ID.
  4. Go through Apple’s location verification if prompted.
  5. Confirm your account.
  6. Click “Allow” to the pop-up “Do you want to download?”.

    Xcode size

  7. CAUTION: Make sure that your machine has enough free space available.These are massive files that may take a while to download if you don’t have a fast internet connection.NOTE: Each version of Xcode is related to a specific version of the Apple OS Mac operating system.
    File Date Download Unpacked
    Xcode_12.1 2020-10-01 10.5 GB 11.5 GB
    Xcode_11.5 2020-06-01 7.5 GB ? GB
    Xcode_10.2.1 2019-04-17 ? GB 6.1 GB
    Xcode_9.0 2017-09-19 . ? GB ? GB
    Xcode_8.2.1 8C1002 2016-12-19 ? GB ? GB
    Xcode_8_beta_2.xip 2016-07-05 5.9 GB 12.32 GB
    Xcode_7.31 2016-05-03 3.8 GB ?
    Xcode_4.1 2014- 2.9 GB ?
    Xcode_3.2.4 2014- 2.? GB ?
  8. Switch to Finder Downloads folder to watch progress on the file name ending with “Download”. The one with a clock icon which signifies downloading.
  9. Return to the versions instructions above to view the updated version.
  10. Delete the installer after you’re done, to reclaim disk space.

Xcode IDE Upgrade

Over time, Apple updates Xcode and its command line utilities.

  1. Click the Apple icon, then click System Preferences. Here is an example notification:
  2. Search for “Software Updates” or click the icon.
  3. Click “Update Now” if that appears. (but first do a backup.)
  4. Click “Agree” to the EULA.
  5. When done, view the version numbers installed.

Xcode FileMerge tool

Xcode graphically compares files and directories.

  1. Open Xcode. This takes a few seconds.
  2. Right-click on Xcode icon. Select “Open Developer Tool”. Select “FileMerge”.
  3. Specify one file to compare.
  4. Specify the other file to compare.
  5. Click “Compare”.

More on OSX

This is one of a series on Mac OSX:


Scroll to Top