Nativescript-cli: NativeScript cli error when tns run ios or any command related to IOS platform

Created on 1 Nov 2017  路  31Comments  路  Source: NativeScript/nativescript-cli

_From @fawzywassel on October 31, 2017 18:6_

cli error =>
NativeScript can only run in Xcode version 6.0 or greater

_Copied from original issue: NativeScript/NativeScript#5015_

question ios

Most helpful comment

I had the same issue and this solved mine

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

reference https://github.com/nodejs/node-gyp/issues/569

All 31 comments

_From @NathanaelA on October 31, 2017 19:17_

@fawzywassel -- Do you have XCode 8 or 9 installed?
See: https://docs.nativescript.org/start/quick-setup

_From @fawzywassel on October 31, 2017 19:33_

yes i have XCode 9 , and i follow this steps and all is installed perfect

_From @fawzywassel on October 31, 2017 19:35_

screen shot 2017-10-31 at 9 34 42 pm

_From @fawzywassel on October 31, 2017 19:37_

screen shot 2017-10-31 at 9 36 47 pm
this is my xcode version

_From @NathanaelA on October 31, 2017 20:11_

A couple things you can try:

  1. what does xcodebuild -version say?
  2. what does c++ --version say?
  3. What does tns doctor say?

_From @fawzywassel on October 31, 2017 20:15_

xcodebuild -version
Xcode 9.0
Build version 9A235
c++ --version
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin17.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
tns doctor
Your components are up-to-date:
nativescript,tns-core-modules,tns-android,tns-ios

_From @NathanaelA on October 31, 2017 20:49_

@fawzywassel - Everything looks correct based on that. So when you do a

  • tns create name
  • cd name
  • tns platform add ios
  • tns build ios

You get that error, correct? , this is from a brand new project correct?

_From @fawzywassel on October 31, 2017 20:51_

yes

_From @NathanaelA on October 31, 2017 20:54_

Can you do a tns info?

_From @fawzywassel on October 31, 2017 20:55_

screen shot 2017-10-31 at 10 55 20 pm

_From @fawzywassel on October 31, 2017 21:2_

this issue happen when i trying to add/remove/build/prepare ios

_From @NathanaelA on October 31, 2017 21:28_

@tsonevn - Any ideas? This also probably needs to be moved to the CLI repo...

Hi @fawzywassel
Could you try to open a Xcode, create a new native project and build it on iOS Simulator? This will help to verify, whether everything is properly configured. If everything works correctly, please try again to create a project and to build it, while following the above-given instructions.

Also, could you run xcode-select -v and to provide, what does the command say?

xcode-select -v
xcode-select version 2349.

xcode new gererate native apps work normaly with no errors

@fawzywassel

We are still unable to recreate this behavior on our side, which makes the research on the problem hard. Something that you could check on your side is if the correct path is set up for the Xcode while running xcode-select -p. The command should return a string similar to the below attached one:

/Applications/Xcode.app/Contents/Developer

Also, you could verify, the returned Xcode version in the terminal via xcodebuild -version and to check if it is the correct one.

xcode-select -p Yes, it returned the same you suggest
xcodebuild -version
Xcode 9.0
Build version 9A235

Hi @fawzywassel,
Thank you for your suggestion, however, at this point, a remote session is not applicable. After the research we made with our developers on our side this issue seems to be related to your local environment setting and in our further investigation we found that the issue should be related to the info parsing after executing xcodebuild -version | head -n 1 | sed -e 's/Xcode //'.

Regarding that please run xcodebuild -version | head -n 1 | sed -e 's/Xcode //' again, while using all arguments after the command and send us the output.

Thank you in advance for your cooperation.

screen shot 2017-11-04 at 12 23 02 am

@tsonevn please help me .....

Hi @fawzywassel,
After reviewing the log from the error from the console, I found that the problem could be related to the overwriting the head command in the machine. The current command does not have -n option, which is needed to run the build.

To confirm that this is the case you could run the following commands and verify if the log on your side will be the same.
which head ->result /usr/bin/head
ls -la /usr/bin/he ->result No such file or directory
ls -la /usr/bin/head ->result -rwxr-xr-x 1 root wheel 18864 23 Mar 2017 /usr/bin/head

If there is a difference. you could run the following command in the terminal:
export PATH=/usr/bin/head:$PATH
The command will set up the path to the needed head, while merging it with the current one.

After that try to build an application in the same tab while using tns run ios

@tsonevn
after run all command only one is not the same
which head result is /Applications/XAMPP/xamppfiles/bin/head
and still the same after run export PATH=/usr/bin/head:$PATH

Hi @fawzywassel,
Could you execute one more time the following command export PATH=/usr/bin/head? This time close the terminal and open it again. Then run echo $PATH and validate that the same path(/usr/bin/head) is printed.

If the path is correct, run xcodebuild -version | head -n 1 | sed -e 's/Xcode //' command, to verify if the correct version of the Xcode will be printed.

After that delete node_modules and platforms folders and rebuild the app with tns run ios

@tsonevn
Thanks for your support
its working now

I had the same issue and this solved mine

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

reference https://github.com/nodejs/node-gyp/issues/569

@narayananl23 also working for me. Thank you!

I faced the same scenario after fresh install of Xcode 9.2. Thanks @narayananl23 for a solution!

@narayananl23 this worked for me too, thanks!

@narayananl23 Worked for me as well! Thank you so much.

But for me is still not working, i have tried all things what is mentioned here. Here is my stackoverflow ticket https://stackoverflow.com/questions/54873245/nativescript-can-only-run-in-xcode-version-6-0-or-greater.

any news about this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leevigraham picture leevigraham  路  3Comments

bradmartin picture bradmartin  路  3Comments

Anilinfo2015 picture Anilinfo2015  路  3Comments

charsleysa picture charsleysa  路  3Comments

MrCroft picture MrCroft  路  3Comments