# 下載 Xcode 的正確姿勢

請參閱我的新文章：[安裝 Xcode 的正確姿勢](https://www.notion.so/ethanhuang13/Xcode-dfbe2d934ff84b2d84e34ffceef56fe0)

（以下為舊版文章）

如果你是積極跟上新版 Xcode 的開發者，常常下載更新版是免不了的。有的時候還會要裝兩到三個版本。像這樣：

![硬碟都被 Xcode 塞滿了](/files/-LCoNkP7DzQS1f-l544b)

怎樣下載 Xcode 呢？最簡單的方式當然是透過 Mac App Store。

但是 MAS 有幾個問題，我極力避免：

* 下載過程中，Xcode 不能使用
* MAS 傳輸進度有時候會中斷或不知道怎麼了
* 有新版時會一直提示你要更新
* 只能維持一個 Xcode 版本。實際上開發時可能會用到多個版本
* 不能下載 beta 版

## 從 Download -> More 下載

因此，我都是從 <https://developer.apple.com/download/more/> 下載我需要的版本。這個頁面如果從 [Download](https://developer.apple.com/download/) 進去的話，要捲動到最下面才看得到。

![藏得真是隱密](/files/-LCoLpO_FriX96DNXgo4)

![各種歷史版本隨你挑囉](/files/-LCoMDknHfVbNFyvQoNX)

## 透過 xcode-install

你也可以透過 [xcode-install](https://github.com/KrauseFx/xcode-install) 這個 ruby 套件，用指令來下載，會更加方便。例如：

```bash
$ gem install xcode-install
$ xcversion install 9.3.1
```

唯一要注意的是，這個套件會把你的 Apple ID 跟密碼存在電腦 Keychain 裡面，跟 fastlane 的原理一樣。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ethanhuang13.gitbook.io/wikipitia/xcode-pitfalls/download-xcode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
