Can I have multiple Xcode versions installed? - xcode

Is it possible to have more than one version of Xcode installed at the same time?
If so, please post any tip, tricks, or potential issues to watch out for.
EDIT:
The reason I want to install multiple versions is to try out the new sdk beta, but if the new Xcode is buggy I want to be able to use the older version for my existing projects.

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 http://developer.apple.com/documentation/Xcode/Conceptual/XcodeCoexistence/Contents/Resources/en.lproj/Details/Details.html this Apple Developer Connection page for lots of details. <- Page does not exist anymore!

Can I have multiple Xcode versions installed?
Solution:
Actually as many of the above answers says, it is possible.
Even according to the following Oracle Mobile Platform Blog, you can install more than one XCodes in the same Mac. The reason why you need to do that may vary according to you.
Scenario:
You might have installed only one version of XCode for now. Mostly the one release behind the latest XCode version which is available through App Store (mine I've Xcode 6.3.2 and I needed to keep it and also install Xcode 7 which is available through App Store).
For Ex:-
You have already installed XCode 6.x, and App Store has XCode 7
already given by App Store. For any reason you need to keep that Older
XCode 6.x(as you know it is stable for some time now) and also you
need to install and try out new XCode 7
So number one question might be, How and Where could you download the Mac OS X installable DMG file for XCode 7 (or may be if you wanna try out an older XCode version)? Ok, here is the direct link apple downloads (you might have to log into Apple Developer account before viewing this link correctly), or else following is a StackOverflow Q&A link which gives the answer to where to download DMG files for XCode IDEs.
So now let's assume that you have obtained any of the DMG file for the XCode version you require to install as secondarily?
Steps:
Follow the steps given bellow which I got from the above given first link of Oracles Mobile Platform Blog.
Close Xcode if running
Rename /Applications/Xcode.app to /Applications/Xcode_6.x.app
Enter the admin password when prompted
Double click the DMG file of your required, pre-downloaded Xcode and install it
Once installed it, before running it, change the new
/Applications/Xcode.app that was just installed to (according to my above given example) /Application/Xcode_7.app
Note*:
[Please patiently read this section until the next Note] When you have two versions of Xcode installed, your workstation has two versions of Command Line Tool (xcodebuild) installed too. The question is what your Terminal and Xcode build command will use to when you are building your iOS App. Because along with the Command Line Tool, iOS SDK which is being used to build your app also depends on.
My experience was I've had two Xcode versions. Xcode 10 (Old one with iOS12.0 - iphoneos12.0), and Xcode 10.1 (New one with iOS 12.1 - iphoneos12.1). So obviously the settings for Command Line Tool was selected to use xcodebuild tool from the Old app. I had to manually select it in Xcode preference window.
Where to set Command Line Tool in Xcode Preference Window?
Select the Locations tab and there, you can select all the installed versions of Command Line Tools (which is xcodebuild).
How to figure out which version of iOS SDK is being used to build your iOS App?
On your Terminal issue following command:
$> xcodebuild -showsdks
Above command should print out all the SDK details which your current Xcode configuration uses to build your Apps. And by seeing the results you will understand that your iOS/iphoneos SDK version depends on changing Command Line Tool (xcodebuild) setting on your Xcode.
Note**:
Above given Apple Downloads link and Oracles MPF blog post links might change and/or unavailable in the future.
So I hope that my this answer might be helpful to somebody else out there!
Cheers!

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

You may want to use the "xcode-select" command in terminal to switch between the different Xcode version in the installed folders.

It seems that Xcode really likes to be in the Applications folder and be called Xcode, especially when using xcodebuild (when building for Carthage for example) - and xcode-select doesn't always seem to cut it.
I have a client project that's still using Swift 2.2, and I'm stuck on Xcode 7 for that and using Xcode 8 for anything else.
So, in my Applications folder, I have Xcode 7 (renamed to Xcode_7) and Xcode 8 (renamed to Xcode_8). Then I rename whichever one I need to simply Xcode, and back again when done. It's a ball-ache, but seems to work.
This shell script simplifies it a bit…
xcode-version.sh
cd /Applications
if [[ $1 = "-8" ]]
then
if [ -e Xcode_8.app ]
then
mv Xcode.app Xcode_7.app
mv Xcode_8.app Xcode.app
echo "Switched to Xcode 8"
else
echo "Already using Xcode 8"
fi
elif [[ $1 = "-7" ]]
then
if [ -e Xcode_7.app ]
then
mv Xcode.app Xcode_8.app
mv Xcode_7.app Xcode.app
echo "Switched to Xcode 7"
else
echo "Already using Xcode 7"
fi
else
echo "usage: xcode-version -7/8"
fi
xcode-select --switch Xcode.app

Note that if you use the xcodebuild command line tool, then the last version of Xcode installed will become the default version. (A symbolic link is installed in /usr/bin.) To use the xcodebuild for the other versions of Xcode you'll need to use the version in the (xcode_install_directory)/usr/bin directory.
note To switch between different versions of the Xcode command-line tools, use the xcode-select tool mentioned by other commenters.

Multiple Versions Of Xcode & Simulators using gem Xcode::Install
Install and update your Xcodes automatically.
You can greatly simplify this process by using the
Xcode::Install Ruby Gem.
You should already have a working installation of the
Xcode Command Line Tools and a version of Ruby that supports building native extensions.
I'd suggest using Homebrew for installing
rbenv and use rbenv to install Ruby.
A guide for this can be found here and many other places.
But it should work with the stock Ruby supplied by newer macOS versions as well, if you install the gem either using sudo (not recommended) or using --user-install when installing the gem.
Installation
Basically:
# Install the Ruby Gem (I'm using rbenv, so no sudo or --user-install)
$ gem install xcode-install
# To list available versions:
# PS!You will get prompted for your Apple Developer / iCloud credentials)
# It's using Apple's own API's so 2FA are supported if enabled
$ xcversion list
6.0.1
6.1
6.1.1
6.2 (installed)
6.3
# To update the list of available versions, run:
$ xcversion update
# To install a certain version, simply:
$ xcversion install 8
##################################################################### 100.0%
Please authenticate for Xcode installation...
Xcode 8
Build version 6D570
This should download and install and activate that version of Xcode.
You can start it from /Applications as usual.
The new version will also be automatically selected for CLI commands
To select a different version as active, you'll run:
xcversion select <version_number>
from the list of installed versions, marked as (installed) like:
# To see the active version in use:
$ xcversion selected
# To select and activate an installed version:
$ xcversion select 8
# To select, activate and change the symlink in /Apllications
$ xcversion select 8 --symlink
Other fun stuff, Simulators etc
Xcode::Install can also install Xcode's Command Line Tools by calling
xcversion install-cli-tools
and can also manage your local simulators using the simulators command.
But instead of repeating more information that is probably going to change over time, head over to the project's GitHub page
for more about this gem.

Staring with Xcode 9, the beta Xcode is labeled 'Xcode-beta.app' and is designed to live side by side with the production version. Info can be found in the Xcode release notes here. (Not using direct link because it breaks often).
From Apple:
Xcode 9 beta 4 can coexist with previous versions of Xcode. Prerelease
versions of Xcode are made available from developer.apple.com,
packaged in a compressed XIP file. To install Xcode during the beta
period, download the XIP file, double-click the file to expand it in
place, then drag Xcode-beta.app to the Applications folder

Download a version
The beta and stable releases can be taken from the Developer Software downloads Application tab, here), but older versions can be taken from here. Just extract the .xib and put Xcode-beta.app in your Applications folder.
Switch versions
Using the beta: sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer
Using the original: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Check version changed
You can validate the version has changed by running xed --version, and it will output the correct version: e.g. xed version 12.5 or xed version 13.0

To have multiple Xcode instances installed you can put them to different folders for example /Developer5.0.2/Xcode, but to use them in CI or build environment(command line) you need to setup some environment variables during the build.
You can have more instructions here.
So it is working not just with beta and fresh release, also it's working for the really old versions, you might need it to use with Marmalade or Unity plugins which is not support the latest Xcode versions yet(some times it's happens).

Whatever advice path you go down, make a copy of your project folder, and rename the external most one to reflect what XCode version it is being opened in.
Your choice on whether you want it to update syntax or not, but the main reason for all this bovver is your storyboard will be altered just by looking. It may be resolved by the time a new reader coming across this in the future, or

All the updates for new version of xcode will be available in appstore if you have installed the version from appstore. If you just paste the downloaded version appstore will show install not update. Hence keep the stable version downloaded from appstore in your applications folder.
To try new beta releases i usually put it in separate drive and unzip and install it there. This will avoid confusion while working on stable version.
To avoid confusion you can keep only the stable version in your dock and open the beta version from spotlight(Command + Space). This will place beta temporarily on dock. But it will make sure you don't accidentally edit your client project in beta version.
Most Important:- Working on same project on two different xcode might create some unwanted results. Like there was a bug in interface builder that got introduced in certain version of xcode. Which broke the constraints. It got fixed again in the next one.
Keep track of release notes to know exactly what are additional features and what are known issues.

First, remove the current Xcode installation from your machine. You can probably skip this step but I wanted to start fresh. Plus — Xcode was behaving a little weird lately so this is a good opportunity to do that.
Install Xcode 8 from the App Store. Make sure project files (.xcodeproj) and workspace files (.xcworkspace) can be opened with the new Xcode installation (remember to select the Later option whenever prompted).
Download the Xcode 7.3.1 dmg file from Apple. Double-tap the newly downloaded dmg file in order to get the standard “Drag to install Xcode in your Applications folder”. Don’t do that. Instead, drag the Xcode icon to the desktop. Change the file name to Xcode 7.3.1. Now drag it to the Applications folder.
Now you have two versions of Xcode installed on your machine. Xcode 7.3.1 and Xcode 8.
Details: Install Xcode 7 & Xcode 8 side by side

Related

xcode 6.1 installation process

I installed Yosemite a couple of days ago. It really broke quite a lot of things - broke my favorite game which won't start, broke my php installation, my wordpress installation, and now Homebrew! But the spotlight feature is nice, not that it makes up for it lol.
Nonetheless I'm trying to fix Homebrew which is telling me to update to XCode 6.1. I've run software update and it says the XCode 6.1 has been installed (sort of). It has:
Command Line Tools (OSX 10.10) - Version 6.1 Installed Oct 17, 2014 (twice actually)
Xcode Version 6.0.1 - Installed Oct 17, 2014
And no pending updates.
But when I check the locations tab in Xcode preferences - it says it's using Command Line Tools 6.0.1. And when I run brew doctor it tells me to upgrade to 6.1 CLT.
How do I update the CLT to 6.1? (note I'm not on Apple Developer program)
The link that #richard-g provided doesn't seem to work anymore, but I just found the dmg file on
https://developer.apple.com/downloads/
using an appleID that has only a free developer login.
On that page I found both Xcode 6.1 and the command line tools for OS X 10.10 for Xcode 6.1.
Before finding that, on the first machine that I upgraded from Maverick to Yosemite that already had Xcode installed on it, I was able to upgrade Xcode in the App Store and then run Xcode and from within it download and upgrade the command line tools, but App Store continues to show Xcode as one update available with just an "Open" button. I'll see if installing the downloaded dmg takes care of that, and in any case I have other machines to upgrade and could use the offline install package. The download site seems very very slow, though, the 2.5GB download is taking all day.
It worked - installing the 6.1 XCode from this download https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_6.1/xcode_6.1.dmg
and it worked fine. I just had to go to Xcode -> Locations and select the 6.1 CLT, then open a new command prompt.
brew doctor
Your system is ready to brew.
========================================================
Sorry as per comments - the link to XCode is no longer working
As you have Xcode 6.1 installed, you can run xcode-select --install from a shell to download the correct CLT.
This link works without without requiring login:
https://developer.apple.com/downloads/index.action

How do you update Xcode on OSX to the latest version?

What is the easiest way to update Xcode on OSX?
I see this in the terminal:
$ brew install xxxxxxx
Warning: Your Xcode (4.3.3) is outdated
Please install Xcode 4.6.
But when I go to open up Xcode > Preferences > Downloads, it says there are no updates?
Open up App Store
Look in the top right for the updates section (may also be in lefthand column "Updates"..)
Find Xcode & click Update
softwareupdate --list see the list of outdated software.
softwareupdate --install --all update all outdated software.
softwareupdate --install <product name> update the software you named.
Sometime I don't see the Xcode update in Updates tab in AppStore
So I search Xcode in AppStore
Then click update and it update
If attempting to download via the App Store leaves you with a little grey spinner and nothing actually happening, then you can go to :
https://developer.apple.com/download/more/
log in with your Apple Developer ID, and the latest Xcode should be available as a .zip download.
In my case (Xcode 6.1, iOS 8.2) I did not see the update in AppStore.
I found Xcode 6.2 for download and pressed "Install".
Then, it installed and asked for the update (more than 2 Gb).
Xcode 6.2 works correctly with iOS 8.2 and iOS 8.1.2
Hopefully this tip will help somebody else...
xcode-select --install worked for me
Another best way to update and upgrade OSX development tools using command line is as follows:
Open terminal on OSX and type below commands. Try 'sudo' as prefix if you don't have admin privileges.
brew update
and for upgrading outdated tools and libraries use below command
brew upgrade
These will update all packages like node, rethinkDB and much more.
Also, softwareupdate --install --all this command also work best.
Important: Remove all outdated packages and free some space using the simple command.
brew cleanup
If you want the latest Beta, it will not be in the AppStore. Instead you have to login to https://developer.apple.com and download from there.
In my case I solved this "no updates" issue by accessing AppStore from the developers link:
https://developer.apple.com/download/release/
Apart, you might find this command useful: mas-cli-github
$ brew install mas
$ mas list
$ mas search Xcode
$ mas install <id>
$ mas upgrade <id>
I ran into this bugger too.
I was running an older version of Xcode (not compatible with ios 9.2) so I needed to update.
I spent hours on this and was constantly getting spinning wheel of death in the app store. Nothing worked. I tried CLI softwareupdate, updating OSX, everything.
I ultimately had to download AppZapper, then nuked XCode.
I went into the app store to download and it still didn't work. Then I rebooted.
And from here I could finally upgrade to a fresh version of xcode.
WARNING: AppZapper can delete all your data around Xcode as well, so be prepared to start from scratch on your profiles, keys, etc. Also per the other notes here, of course be ready for a 3-5 hour long downloading expedition...
You DO NOT need to upgrade Xcode.
Just open the file /usr/local/Homebrew/Library/Homebrew/extend/os/mac/diagnostic.rb ,
then remove this line check_xcode_minimum_version in the following function.
def fatal_build_from_source_checks
%w[
check_xcode_license_approved
check_xcode_minimum_version //<-- this one
check_clt_minimum_version
check_if_xcode_needs_clt_installed
].freeze
end
Then brew install should works fine.
I used the Command_Line_Tools_OS_X_10.XX_for_Xcode_7.2.dmg and therefore had to download the latest version from here.
Check https://xcodereleases.com/ where you can also download legacy versions.
For me it was >41GB for the update to start. ~/Library contains a lot of cached content for mail, browsers, etc...you can safely remove those. Remove big apps too, like iMovie..you can always install it back later

Uninstall Previous XCode and Install XCode 4.5

Is it safe to completely uninstall previous version of XCode and Install the XCode 4.5? because...
I just uninstalled XCode 4.2, and it mostly removed all the files in the Developer Folder, now I installed the 4.5, but it scares me since there is nothing in the Developer Folder.
Would XCode still be working even if that's the case? Thanks
Xcode 4.4+ was designed to be installed via the App Store and now stores everything in the Xcode.app bundle in your /Applications directory.
Make sure you use xcode-select to select the new path for your Xcode installation, and you install the command line tools from within Xcode 4.5.
From the Xcode 4.5 release notes:
Starting in Xcode 4.3, the Xcode.app file package contains all the Xcode developer tools. The man pages for the command-line tools Xcode uses are also placed in this package.
yes It's totally safe to completely uninstall the previous Xcode and install new Xcode4.5. I have done it and all works fine for me.
Just have to install the command line tools after installing the Xcode4.5 from it's preference just as show in below image :)

Xcode says I have 4.2 installed, but only 4.1 opens

I'm confused about this. When I go on the market or try to download 4.2 to get ios5 it says that it is Installed. I check my Xcode in the about section and it says it is running 4.1. I tried this Install Xcode that is in my applications folder assuming maybe it was for the update and it still shows 4.1. How do I update my xcode?
In your Applications folder, there is an app called Install Xcode. Run that to actually install Xcode4.2 after the App Store finishes downloading the upgrade. Weird, unexpected process, I know.
I had the same problem. After reading the answers here I looked for the "Install Xcode.app" file in the /Application directory and it wasn't there. It turns out that I had moved the "Install Xcode.app" bundle out of /Applications after I installed Xcode 4.1 (I didn't think it would be used again). I used Spotlight to remind me where I had moved it to and I ran it again and it updated the files. Now Xcode reports it is at version 4.2 like I expected. This is not at all like any other Apple installs. I wonder why they did it this way.
The App Store doesn't upgrade Xcode 4.1 to Xcode 4.2 for you like it does for all other apps. Instead, it just downloads an installer/upgrader which gets placed in your Applications folder, and proceeds to not tell you anything about it, hoping you can read its mind. To upgrade, you have to do this:
Download the update via App Store.
Manually upgrade by running: /Applications/Install Xcode
Another way to do an upgrade will be to manually remove Xcode 4.x first:
Delete Xcode: $ sudo rm -r /Developer (takes about 20 minutes to finish)
Delete any "Install Xcode" files from your Applications folder.
Download Xcode 4.2 from the App Store.
When finished, install it: Applications ---> Install Xcode
Re-download all Xcode Documents and Components: Xcode ---> Preferences ---> Downloads
That's the most extreme way of doing things. If you added anything to your /Developer folder, you should back it up before running the rm -r command, as that will delete EVERYTHING in it.
Your Xcode preferences will remain in-tact, as they're stored in ~/Library/Application Support/Xcode/ and ~/Library/Preferences/com.apple.dt.Xcode......plist
follow the instructions given in http://simplecodebits.blogspot.com/2011/10/update-to-xcode-42-in-mac-osx-lion.html

How do i install additional packages for Xcode on OSX Lion to allow MacPorts to work

When I try and install MacPorts it complains
'Xcode is not installed, or was installed with UNIX Development (10.5+) or Command Line Support (10.4) deselected.'
I do have Xcode installed from the Appstore so I guess I just have to install these extra parts but how ?
Ive read a couple of questions on Stack Overflow about this but I think the answers must be outdated as they do notmake sense for me, I do not have an Xcode dmg I can reinstall from, and I can't see anything useful in /Developer either, or any preferences within Xcode itself.
I only want Xcode for the purposes of using Macports so I'm not familiar with it.
You probably got Xcode 4.1 from the Mac App Store. In that case, you haven't got Xcode 4.1 installed. However, you now have an Xcode installer in your Applications directory.
Spotlight should find it in any case.
The command line tools aren't included in the default install of Xcode anymore.
Goto the Xcode Preferences --> Downloads Pane --> click the Install button beside "Command Line Tools".
If you don't have Xcode installed you can get the command line tools separately as explained here..
http://osxdaily.com/2012/07/06/install-gcc-without-xcode-in-mac-os-x/
The App Store installs the XCode installer, not Xcode itself. The installer is in your applications folder. Run that.
Today, 16 Feb 2012, when I installed Xcode 4 from the App Store, there was no Setup. Just the app installed, because it was Xcode 4.3 !
Make sure that you install Xcode 4.2 with UNIX Devel. to MacPorts works!
To get the Xcode 4.2 go to https://developer.apple.com.

Resources