Xcode-select

Hello, when I try to build in ios getting an error.

CordovaError: Promise rejected with non-error: ‘xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a command line tools instance\n’
at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
at process._tickCallback (internal/process/next_tick.js:68:7)

here is my ionic info output.

Ionic:

ionic (Ionic CLI) : 4.10.3 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.2

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 23 other plugins)

System:

NodeJS : v10.15.1 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS High Sierra

I had a similar problem. Here is what I did to resolve the issue:

  1. I had to make sure I had the command line tools installed (see https://developer.apple.com/).
  2. Then I had to go into Xcode Preferences, under the Locations tab, and select the command line tools I just installed.

After, I ran “xcode-select -p”. The new path was “/Applications/Xcode.app/Contents/Developer”
Give this a try to see if that helps. I am running on Mojave with a slightly newer version of Ionic (4.11.0)

If you already have the command line tools installed you could just try running “xcode-select -s /Application/Xcode.app/Contents/Developer”. Not sure how well this would work, as I have not tried it.

1 Like

I had similar issue when running ionic cordova build ios --prod. Well to solve this issue there some stuffs have to check:

First make sure you have Xcode Installed with command line tools also
If you have Xcode installed already check the version and your mac version to download the right command line tools.
Download the command line tools here Command Line Tools
After install it and run this command to fix the xcode-select path

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

After this run the command again. Am sure this will work for you

3 Likes

Thanks…Same solution worked for me.