Error when running 'sudo authorize-ios'

I’m a newbie in using Appium with iOS simulator and I’m now just trying to set it up. I read that I should authorize use of the iOS simulator by running the below command:

sudo authorize-ios

I tried the command and got the error below. Can someone help on how to resolve the error?
Thanks!

info AuthorizeIOS Enabling DevToolsSecurity
info AuthorizeIOS Updating security db for developer access
info AuthorizeIOS Granting access to built-in simulator apps
info AuthorizeIOS The xcode directory is : /Applications/Xcode.app/Contents/Developer
info AuthorizeIOS Changing ownership to ‘monicamendoza’ on directories: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Applications
ERR! AuthorizeIOS Encountered an issue changing user priveledges for iOS sim app dirs: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Applications
ERR! AuthorizeIOS Error was: Command ‘chown -R monicamendoza: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Applications’ exited with code 1

Can you please specify, which Appium version you are using?
Also please try command: sudo $(npm bin)/authorize-ios
See if that works.
Useful link: https://github.com/appium/appium/blob/master/docs/en/contributing-to-appium/appium-from-source.md

I’m using the Appium GUI version 1.5.2

I tried running the command you mentioned but I just got the ‘Command not found’ error.

Do you have npm installed ?
To check if it is installed on your Mac, just type npm, if you get commnad not found, then you don’t have npm installed, you can install it by running command: brew install node
Please go through the link i mentioned in my previous comment.
Also make sure you have HoneyBrew installed, to install honeybrew, just type the following command in the Terminal:
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

Yes, I have both npm and homebrew installed.

Are you running sudo $(npm bin)/authorize-ios in your Appium folder?

I just ran it from Appium folder now and still got command not found error.

Ms-MacBook-Pro:Applications monix$ cd /Applications/Appium.app
Ms-MacBook-Pro:Appium.app monix$ sudo $(npm bin)/authorize-ios
sudo: /Applications/Appium.app/node_modules/.bin/authorize-ios: command not found
Ms-MacBook-Pro:Appium.app monix$

Can you walk me through, how you installed Appium, i thought you are running it from the source, but in your last comment I see you are running the command in the Appium.app folder,
did you install it through npm?
If yes, then you must have that appium in a different location (maybe in you user folder),
Please do the following:

  1. Open terminal and type ls -lrt, see if you have appium folder there.
  2. If yes then navigate to that folder and run sudo $(npm bin)/authorize-ios again

Sorry, I actually have 2 installations. Initially I installed the Appium GUI but then I had problems with it using the latest Android Studio so I installed the latest version using npm.

I tried doing ls -lrt but there’s no Appium folder in the results.

Please do the following then:

  1. Open terminal
  2. Run the following commands:
    git clone https://github.com/appium/appium.git
    cd appium
    npm install
    gulp transpile
    sudo $(npm bin)/authorize-ios

Let me know if this works.

It worked up until

gulp transpile

I got ‘command not found’ when I typed it.

It seems you don’t have gulp:
run the following commands:
npm install -g gulp
npm install -g gulp-cli

Okay, so I was able to run all commands but I still got the same error after running ‘sudo $(npm bin)/authorize-ios’

info AuthorizeIOS Enabling DevToolsSecurity
info AuthorizeIOS Updating security db for developer access
info AuthorizeIOS Granting access to built-in simulator apps
info AuthorizeIOS The xcode directory is : /Applications/Xcode.app/Contents/Developer
info AuthorizeIOS Changing ownership to 'monicamendoza' on directories:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications, /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Applications
ERR! AuthorizeIOS Encountered an issue changing user priveledges for iOS sim app dirs: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Applications
ERR! AuthorizeIOS Error was: Command 'chown -R monicamendoza: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Applications' exited with code 1

Not sure what’s wrong but I tried doing all these in another macbook and it worked fine. Do you think it’s because I have multiple appium installations?

This seems more of a problem with your Xcode than Appium,
Can you check if Xcode command line tool is installed properly on your Mac?

It seems that the Xcode command line tool is installed properly since I was able to run ‘gcc --version’.

You think it will help if I reinstall Xcode?

That might work, but before that, please check if you have multiple Xcode versions installed?

Hmm…didn’t work as well :frowning: Checked and I only have one Xcode installed. Tried reinstalling but still got the AuthorizeIOS error.

i am also facing the same error and unable to find out…

Try typing “sudo su” first before the command “sudo authorize-ios”. I’m not sure if that’s the reason but it suddenly worked for me.

the problem is due to the Permission level , after making changes to chmod 777 it worked fine