Mac Full Xcode 설치하기

2021. 3. 19. 23:27DEV/ETC

반응형

MacOS에서 개발환경을 설정하려면 Xcode가 기본으로 설치되어 있어야 합니다. 그러니 가장 먼저 Xcode를 설치해 주세요. 예전에 여러 언어 관련 개발 환경을 설정할 때 Xcode 관련 오류가 발생한 적이 종종 있어서 가장 신경이 쓰이는 부분이었어요. 그래서 이번에는 문제가 없도록 설치를 해보려 합니다.

💡 이 포스팅의 설치 방법은 Flutter 개발 환경 설정하면서 작성했습니다. 다른 개발 환경에서 발생하는 오류가 있는 지는 검증되지 않았다는 점 참고해 주세요. (2023년 3월 31일 업데이트)

App Store에서 설치

App Store에서 Xcode를 검색해서 설치를 진행합니다. 시간이 좀 걸리니 여유 있게 기다려주세요.

Xcode 설치 확인

설치가 끝나면 터미널을 열어서 설치된 경로를 확인합니다.

만약 Xcode가 제대로 설치되지 않은 경우 경로가 /Library/Developer/CommandLineTools로 나오니 참고해 주세요.

### 경로 확인
% xcode-select -p
/Applications/Xcode.app/Contents/Developer

### 기타 명령어 확인
% xcode-select -h
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example, 
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

 

License 동의

Xcode 사용을 위한 라이선스 동의 처리를 합니다. 라이선스 내용이 꽤 길어서 스페이스바를 여러 번 눌러야 해요. 그리고 마지막에 agree를 입력하라고 나오니 주의해서 봐주세요.

% sudo xcodebuild license 


You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Press the 'return' key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/en.lproj/License.rtf'

##### Enter Key 입력 ####

Xcode and Apple SDKs Agreement

PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE USING THE APPLE SOFTWARE OR APPLE SERVICES. THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE. IF YOU AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS, CLICK THE “AGREE” BUTTON. BY CLICKING “AGREE” OR BY DOWNLOADING, USING OR COPYING ANY PART OF THIS APPLE SOFTWARE OR USING ANY PART OF THE APPLE SERVICES, YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW. IF YOU DO NOT OR CANNOT AGREE TO THE TERMS OF THIS AGREEMENT, YOU CANNOT USE THIS APPLE SOFTWARE OR THE APPLE SERVICES. DO NOT DOWNLOAD OR USE THIS APPLE SOFTWARE OR APPLE SERVICES IN THAT CASE.

......

#### Space Bar 입력 ####

......

EA1797
5/24/2022


#### agree 입력 ####
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel] agree

You can view the license agreements in Xcode's About Box, or at /Applications/Xcode.app/Contents/Resources/en.lproj/License.rtf

버전 확인

라이선스 동의를 마쳤으면 버전을 확인해서 정상 설치를 확인합니다.

% /usr/bin/Xcodebuild -version
Xcode 14.2
Build version 14C18

Flutter 오류 처리

Xcode를 설치만 한 뒤 Flutter를 설치하면 아래와 같은 Xcode 오류 문구를 확인하게 됩니다.

% flutter doctor

......

[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch

......

여기에서 다시 설치해야 하나 당황할 필요 없이 사용할 Xcode를 설정하면 됩니다. 설명에 나온 명령어를 실행해주기만 하면 간단하게 해결할 수 있어요.

### Xcode 설정
% sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Password: #### 비밀번호 입력 ####

% sudo xcodebuild -runFirstLaunch
Install Started
1%.........20.........40.........60.........80......Install Succeeded

### Xcode 문제 해결 확인
% flutter doctor                                                       
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.8, on macOS 13.3 22E252 darwin-arm64, locale en-KR)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[!] Xcode - develop for iOS and macOS (Xcode 14.2)
		#### Xcode 관련 내용이 없어졌어요 ####
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your
        plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.76.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 3 categories.

이렇게 Xcode 설치가 끝났어요. 이제 차근차근 개발환경을 설정하면 됩니다.

 

iOS Simulator 확인

Xcode를 설치했다면 iOS Simulator를 사용할 수 있어요. 한 번 열어볼까요?

터미널에서 아래 명령어를 실행해서 Simulator가 정상적으로 실행되는지 확인합니다.

% open -a Simulator

개발 환경 설정하기

💡 MacOS에 Flutter 개발 환경 세팅하기 - feat. Homebrew에서 전체 설치 방법을 확인하실 수 있습니다.
  • Xcode, iOS Simulator
  • Homebrew
  • iTerm2
  • Visual Studio Code
  • Flutter
  • CocoaPods
  • Java
  • Android Studio, Android SDK, Android Emulator
반응형