How to fix xcrun: error

38.0K views
4 min read

If you use the Terminal on a Mac, you may have noticed the error message “xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools).” This error would most likely occur when you’re trying to run some commands after upgrading macOS.

Fortunately, there is a simple solution to resolve the git xcrun error message and get your Command Line Tools back up and running. Keep reading to know what to do next.

What causes xcrun: error: invalid active developer path

Before we go into ways of fixing the xcrun error issue, let’s first find out what can cause it. In most cases, the “xcrun: error: invalid active developer path” appears when you’re trying to run the git command in the Terminal app after updating or upgrading your macOS. 

Actually, the error message shown above is pretty self-explanatory. It says that the active developer path, which is found at /Library/Developer/CommandLineTools, is invalid. This means that the xcrun error has nothing to do with git itself but with the Command Line Tools instead.

How to fix git xcrun: error: invalid active developer path

Now that you know what might have caused the xcrun error message, let’s figure out how to fix it. 

Check the Xcode.app location

If you get the message error: invalid active developer path, missing xcrun: at /Library/Developer/CommandLineTools/usr/bin/xcrun after upgrading your macOS, it’s likely that Xcode.app is in the Applications folder, but System is looking for it somewhere else. So, to fix this problem, use the xcode-select -s /Applications/Xcode.app command to check the location.

Install or reinstall the command line tools

Even if you already have Command Line Tools installed, it’s a good idea to reinstall them to see if that fixes the error message. Here’s how to install Command Line Tools:

  1. On your Mac, open the Terminal app (Go > Utilities > Terminal)
  2. In Terminal, type the following command string: xcode-select --install and hit Enter
  3. You should get the following output: xcode-select: note: install requested for command line developer tools
  4. Click the Install button
  5. Then accept the License Agreement by clicking the Accept button
  6. After the installation is completed, restart Terminal. 

xcode-select

Hopefully the above solution will solve your problem. But if you’re still getting the xcrun error, try the options below.

Tip: The Terminal app that comes with your macOS is fast and can handle almost any command-line task. However, it’s not as cool looking or customizable as Core Shell. It has a great interface you’ll enjoy. Core Shell also supports one-click logging in to remote computers with auto-reconnect capability. But what you’ll probably like the most is the ability to change how your Terminal looks and feels. You can change the color scheme of connections using your favorite colors.

one-click logging in to remote computers with auto-reconnect capability

Install CLT from the Apple Developer download page

If youʼve installed or reinstalled the Command Line Tools from the Terminal, restarted your Mac, and the error still persists, you can also try to install the Command Line Tools manually by downloading a DMG file directly from Apple.

Go to developer.apple.com and download the latest version of Command Line Tools for Xcode. Then install the file manually. 

Force Terminal to use Xcode’s Command Line Tools

If the above didn’t help, you can try forcing the Terminal to use Xcode’s Command Line Tools. Here are the commands you need to know:

  • sudo xcode-select -reset

  • sudo xcodebuild -license

xcrun: error resolved

Seeing the xcrun error can be frustrating. Most of the time, it appears when you’re trying to run some commands after upgrading your macOS. Fortunately, the issue is manageable, and hopefully, the options above will help you fix the git xcrun error. 

And if you want to manage your Xcode projects better, you need to check out Setapp. The platform hosts such apps as XCOrganizer and Core Shell, mentioned in this article, along with dozens of other powerful tools for your workflow. You can use all the apps for seven days free, then $9.99/mo.

240+ apps for $9.99
per month

Sign up to Setapp and try them for free.

Security-tested