Xcode command line tools (two versions side by side) - ios

Recently we've moved to Xcode 8 in order to compile the app with new Xcode version, but I still need to use Old Xcode (7.3.1) in order to use it's instruments with older ver of appium ...
I was wondering if there is a way to open each Xcode ver and to use it's relevant command line tools? currently , the command line tools I set in specific version is being used among two Xcode versions ...
Thanks!

I am using X-code 7.3.3. to run appium test and Xcode-8 to build app under test. I have moved xocde8 into folder name "xcode8".
And to switch between different Xcode version you can use -
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
sudo xcode-select -s /Applications/xcode8/Xcode-8.app/Contents/Developer/

If you have a particular version of Xcode (say Xcode 8) installed in your system, go to /Applications and rename it to something else like Xcode8 or Xcode7.3.1. Install the other version normally. Now you have both versions running in different names.
I hope this is what you were looking for..

Related

How can I configure which xcodebuild tool version is run when running react-native run ios?

After upgrading to Xcode 12, I discovered a project dependency in my larger react-native workspace needs some work to address unsupported architectures.
Until then, I want to continue working on the react-native app, so I installed Xcode 11.7 side-by-side with Xcode 12.
This works fine unless I try to start the app via the CLI tool. It appears the project is still being built by Xcode 12 (the same unsupported architecture errors I saw at compile time are output to the terminal).
which xcodebuild points to /usr/bin/xcodebuild.
What do I need to modify to have version 11.7 run the build command instead of version 12?
You can use xcode-select command to determine at which Xcode version's command line tools the xcodebuild points to:
~ xcode-select -p
/Applications/Xcode.app/Contents/Developer
You can change the selected Xcode version using -s option:
sudo xcode-select -s /Applications/PathToXcode11/Xcode.app

Xcode 8 Command Line Tools Missing (Git, Clang, etc)

Two days ago, I upgraded to OSX Sierra. My development tools seemed to be working fine after that.
However, today I upgraded Xcode 7.3.1 -> 8.1 to make certain features work for React-Native development. To be precise, I deleted the 7.3.1 and installed 8.1 anew. That is where the woes had started.
In particular, it seems that most of the Command Line Tools are gone. I get errors when trying to use git as well as other commands. I was able to get Git back after installing from .dmg file.
I have also tried installing Command Line Tools using xcode-select --install to no avail. Installation proceeds, but none of the tools become available afterwards.
As an example of what is happening, the following are the errors I receive when running: curl -sSL https://get.rvm.io | bash -s stable --ruby
xcodebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk" cannot be located.
gcc: error: unable to find utility "gcc", not a developer tool or in PATH
configure: error: clang version 3.0 or later is required
Does someone know what the issue might be and how one goes about getting the development environment set up on Sierra + Xcode 8.1?
This error occurred after installing the new version of Xcode.
Just restarting helped for me. Sometimes, even quitting and restarting Terminal might also help.
The problem is that you need to repoint the command line tools to the new copy of Xcode. You can use xcode-select to do that, but the easiest way is, in Xcode, go to Preferences > Locations and choose the correct Xcode for the Command Line Tools pop-up menu at the bottom.
Also pls note that in order to use xcode-select you need to use sudo.

Fabric release Xcode 6.3 codesign xcode-select

I'm trying to upload a release to Fabric & I'm getting errors as follows. I'm using the Xcode 6.3 (recently updated).
Xcode: 6.3
Fabric: 1.1.3
OSX: 10.10.3
What should I do to resolve above error & continue uploading the release via fabric desktop tool?
Is there any other way to upload binary to fabric?
Mike from Fabric here.
1) To clear that error from Fabric.app: Quit Fabric.app, then run this command to clear the local cache:
rm -rf ~/Library/Caches/com.crashlytics.mac
You may also need to clear:
rm -rf ~/Library/Caches/com.crashlytics
rm -rf ~/Library/Caches/com.crashlytics.data
rm -rf ~/Library/Caches/com.crashlytics.run
Then restart Fabric.app and you'll be all set!
2) To distribute outside of Fabric.app, use either method mentioned here.
If you have multiple versions of Xcode installed on your system you may need to ensure the command line tools are set for the version of Xcode you're attempting to build from.
Navigate to "Locations" in Xcode preferences (select Xcode from the menu bar, then "Preferences..." then "Locations"). In the drop down next to "Command Line Tools:" select the version of Xcode you're using and then attempt a build.
I had this problem because I have 4 versions of Xcode on my mac, and none of them are named simply 'Xcode'. So, I changed the desired version name from Xcode8.1 back to Xcode.
This part might not apply to most people: If you're using the xcode-select tool (you should if you have multiple versions of xcode on your computer) then you need to make sure xcode-select is pointing to the correct version with the correct name.
The solution for using Xcode beta version
I assume this is due to archive in Xcode beta and the path location does not match. Of course, I experienced this and it worked. Just do this step:
sudo xcode-select --switch /Applications/Xcode-beta.app/
And do upload to Fabric again.

Xcode 4.6 and Xcode 5 installed together

Can we install Xcode 4.6 and xcode 5 on same machine without upgrading from xcode 4.6 to xcode 5?
Yes, you can install multiple versions of Xcode. They will install into separate directories. I've found that the best practice is to install the version that came with your Mac first, and then install downloaded versions, but it probably doesn't make a big difference. See this Apple Developer Connection page for lots of details.
It's easy to have multiple XCode installs.
In the installer there's a pulldown for the location... you just need to pick a new location when you're installing the beta version.
These instructions from an Apple dev tools evangelist have the full details (Apple dev username/password required): https://devforums.apple.com/message/40847#40847
Then grab yourself a custom icon for the Beta version of XCode you're using, so you can tell them apart in the dock: http://iphonedevelopment.blogspot.com/2009/03/multiple-developer-tool-installs.html
I prefer to create separate folders for different versions of Xcode, which I find provides a little more organization than renaming each Xcode release.
My folder layout looks as follows:
/Applications/Xcode.app
/Applications/Xcode4.6/Xcode.app
/Applications/Xcode5.0/Xcode.app
Simply create the necessary folders and drag/drop the relevant Xcode version into the same. You can also download older versions of Xcode from http://developer.apple.com/downloads/ and follow the same idea.
With the folder structure approach, from within a script (e.g. bash shell) you can move between versions of XCode with the xcode-select command line utility by simply specifying the desired folder:
$sudo xcode-select --switch /Applications/Xcode4.6/Xcode.app
Change the release number in the command line to switch to a different version.
Yes, just be sure of having two different names for them!
Yes you can because both can be installed and run simultaneously.
Create a folder with XCode 4 for example and keep XCode 5 in Application Folder.
But, with XCode 5 you can use the property of XCode 4 using iOS 6 sdk. Have a look here.

Xcode stops working after set "xcode-select -switch"

OMG, what I've done?
Couple of days ago, I tried using macport to install something, because I'm using Xcode 4.3 and the command-line tool hadn't been installed by the time, macport wouldn't work. So I followed some guide to get command-line tool installed, then I used following command:
sudo xcode-select -switch /Applications/Xcode.app/
which I think screwed everything except macport: now, in Xcode, even a simple single-view iOS project won't be compiled, it says "UIKit/UIKit.h not found".
Does anyone know how to correct this? I don't want to re-install the gigantic Xcode again, gotta do some iOS project tonight, help!
You should be pointing it towards the Developer directory, not the Xcode application bundle. Run this:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
With recent versions of Xcode, you can go to Xcode ➙ Preferences… ➙ Locations and pick one of the options for Command Line Tools to set the location.

Resources