82
votes

I am very new to macOS, I just need a mac with Xcode to compile my app. However, with macOS Sierra, I have a problem with my USB that is not working anymore (i can't plug my ipad pro)

Under OSX el capitan my usb works great, but now the problem is that app store offer me to download the Xcode 8.3 only that can work only on Sierra (strange they offer you to download something not compatible with your system but doesn't matter, it's apple). so the only way i have is to download manually the xcode 8.2.1

Now my question, how to install the Xcode_8.2.1.xip I just downloaded? and in near future, if I need to update xcode (I guess downloading myself a new version), how will I do? Also where the preferences and configurations settings are saved? does these preferences will be lost on each update?

3
Is there a way to do this in Windows? I don't have a Mac, but I know Swift, and want to keep my skills sharp. Thanks! - ProgrammingEnthusiast
Where did you download the xip file? I'm trying to find Xcode_9.0.1.xip to download it with wget or something similar. - rraallvv
@rraallvv this is where you can download Xcode and other developer tools: developer.apple.com/download/more - Wessam El Mahdy
@rraallvv To download with wget you would need to use the --load-cookies option. Get your cookies after signing into the developer account. - kojow7

3 Answers

113
votes

Double-click the xip file and it will extract the Xcode application. Move Xcode to the Applications folder and you are good to go.

The App Store should present the Xcode update once you update to Sierra (macOS 10.12). If it doesn't you can download Xcode directly from the App Store. The preferences are stored in /Users/<username>/Library/Preferences and are not impacted by updating the version of Xcode or OS.

30
votes

For example, if a XIP file is located on your desktop: open the “Terminal” application found in /Applications/Utilities/ and run the following command:

 xip -x ~/Desktop/Xcode_8.2.1.xip
6
votes

Update: 17 May, 2020: Most easy way

- Download the specific Xcode version that you want [from here][1]
- Add the downloaded Xcode.xip in Applications 
- Double click on it, it will start expand. It will take some time.
- If you have multiple Xcode version like 12.0, 12.1 in Applications rename it accordingly.
- Double click on extracted Xcode version and install tools.
- To set default Xcode version run this command: 

    sudo xcode-select -switch /Applications/Xcode_12.1.app

- To check default Xcode version in your system use this command:

    /usr/bin/xcodebuild -version

Note: Set default xcode step can be skip if you don't have multiple xcode versions in Applications.

Update: 08 Oct, 2020: Easy way

Old Ans

Convert the xip to a dmg by opening a terminal to the folder where the xip is placed and run the following commands:

$ open Xcode_X_Y_Z.xip
  $ mkdir Xcode-tmp
  $ mv Xcode.app Xcode-tmp/Xcode.app
  $ hdiutil create -volname "Xcode" \
            -srcfolder Xcode-tmp \
            -ov -format UDZO \
            Xcode_X.Y.Z.dmg
  $ rm -rf Xcode-tmp