2023. 3. 31. 21:01ㆍDEV/Flutter
Macbook Pro M2 14인치를 맞이해서 개발 환경을 새로 구축 중입니다. 최신 설치 방법으로 다시 정리를 해보려고 해요.
시스템 요구 사항
Flutter를 설치해서 사용하려면 아래의 최소 사양을 확인하세요.
- Operating Systems: macOS, version 10.14 (Mojave) 이상
- Disk Space: 2.8 GB (does not include disk space for IDE/tools).
- Tools: Flutter는 설치와 업그레이드를 위해 git을 사용합니다. git이 포함된 Xcode 설치를 권장합니다. 또는 git을 따로 설치할 수도 있습니다.
⚠️ 만약 개발환경 설정을 이제 막 시작하신다면 MacOS에 Flutter 개발 환경 세팅하기 - feat. Homebrew를 먼저 확인해주세요.
Resetta Translation 설정
| 🔗 How To Install Rosetta On M1 & M2 Macs
만약 아래 목록에 해당하는 Apple Silicon Mac에 설치를 한다면, Rosetta translation environment가 가능해야 해요.
- MacBook Pro introduced in 2021 or later + MacBook Pro (13-inch, M1, 2020)
- MacBook Air introduced in 2022 or later + MacBook Air (M1, 2020)
- iMac introduced in 2021 or later
- Mac mini introduced in 2020 or later
- Mac Studio
직접 확인하고 싶으면 Apple menu > About This Mac을 열어서 Chip의 내용을 확인하시면 됩니다.
이제 Rosetta Translation의 설치를 진행합니다.
% sudo softwareupdate --install-rosetta --agree-to-license
Password:
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
2023-03-28 15:54:15.058 softwareupdate[9744:393033] Package Authoring Error: 032-48321: Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Install of Rosetta 2 finished successfully
⚠️ 만약 설치를 했는데도 Resetta 관련 오류가 발생한다면 터미널 설정을 확인해야 해요. Application 폴더에서 Terminal 앱을 우클릭해서 Get Info를 실행해서 Open using Rosetta가 체크되어 있는지 확인해 주세요.
Flutter 설치
Homebrew를 사용해서 Flutter를 설치합니다.
% brew install --cask flutter
Running `brew update --auto-update`...
==> Tapping homebrew/cask
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-cask'...
remote: Enumerating objects: 718775, done.
remote: Counting objects: 100% (144/144), done.
remote: Compressing objects: 100% (105/105), done.
remote: Total 718775 (delta 85), reused 88 (delta 39), pack-reused 718631
Receiving objects: 100% (718775/718775), 331.87 MiB | 14.42 MiB/s, done.
Resolving deltas: 100% (509993/509993), done.
Tapped 4138 casks (4,212 files, 354.7MB).
==> Downloading https://storage.googleapis.com/flutter_infra_release/releases/stable/macos/flutter_macos_3.
######################################################################## 100.0%
==> Installing Cask flutter
==> Tapping homebrew/core
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 1445731, done.
remote: Counting objects: 100% (266/266), done.
remote: Compressing objects: 100% (151/151), done.
remote: Total 1445731 (delta 161), reused 210 (delta 115), pack-reused 1445465
Receiving objects: 100% (1445731/1445731), 559.50 MiB | 16.14 MiB/s, done.
Resolving deltas: 100% (1009645/1009645), done.
Tapped 2 commands and 6605 formulae (6,959 files, 614.9MB).
==> Linking Binary 'dart' to '/opt/homebrew/bin/dart'
==> Linking Binary 'flutter' to '/opt/homebrew/bin/flutter'
🍺 flutter was successfully installed!
설치 확인
flutter doctor를 실행해서 확인해 줍니다.
% flutter doctor
Building flutter tool...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.8, on macOS 13.3 22E252 darwin-arm64 (Rosetta), 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)
✗ 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)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
% flutter doctor
╔════════════════════════════════════════════════════════════════════════════╗
║ Welcome to Flutter! - https://flutter.dev ║
║ ║
║ The Flutter tool uses Google Analytics to anonymously report feature usage ║
║ statistics and basic crash reports. This data is used to help improve ║
║ Flutter tools over time. ║
║ ║
║ Flutter tool analytics are not sent on the very first run. To disable ║
║ reporting, type 'flutter config --no-analytics'. To display the current ║
║ setting, type 'flutter config'. If you opt out of analytics, an opt-out ║
║ event will be sent, and then no further information will be sent by the ║
║ Flutter tool. ║
║ ║
║ By downloading the Flutter SDK, you agree to the Google Terms of Service. ║
║ Note: The Google Privacy Policy describes how data is handled in this ║
║ service. ║
║ ║
║ Moreover, Flutter includes the Dart SDK, which may send usage metrics and ║
║ crash reports to Google. ║
║ ║
║ Read about data we send with crash reports: ║
║ https://flutter.dev/docs/reference/crash-reporting ║
║ ║
║ See Google's privacy policy: ║
║ https://policies.google.com/privacy ║
╚════════════════════════════════════════════════════════════════════════════╝
Running "flutter pub get" in flutter_tools...
Resolving dependencies in ../../opt/homebrew/Caskroom/flutter/3.7.8/flutter/packages/flutter_tools... (10.4s)
_fe_analyzer_shared 50.0.0 (58.0.0 available)
analyzer 5.2.0 (5.10.0 available)
archive 3.3.2 (3.3.6 available)
args 2.3.1 (2.4.0 available)
async 2.10.0 (2.11.0 available)
built_value 8.4.2 (8.4.4 available)
checked_yaml 2.0.1 (2.0.2 available)
collection 1.17.0 (1.17.1 available)
completion 1.0.0 (1.0.1 available)
coverage 1.6.1 (1.6.3 available)
dds 2.5.0 (2.7.6 available)
dds_service_extensions 1.3.1 (1.3.3 available)
devtools_shared 2.18.0 (2.22.2 available)
dwds 16.0.2+1 (18.0.2 available)
fixnum 1.0.1 (1.1.0 available)
frontend_server_client 3.1.0 (3.2.0 available)
html 0.15.1 (0.15.2 available)
intl 0.17.0 (0.18.0 available)
io 1.0.3 (1.0.4 available)
js 0.6.5 (0.6.7 available)
json_annotation 4.7.0 (4.8.0 available)
logging 1.1.0 (1.1.1 available)
matcher 0.12.13 (0.12.15 available)
meta 1.8.0 (1.9.1 available)
mime 1.0.2 (1.0.4 available)
multicast_dns 0.3.2+2 (0.3.2+3 available)
native_stack_traces 0.5.2 (0.5.5 available)
node_preamble 2.0.1 (2.0.2 available)
path 1.8.2 (1.8.3 available)
petitparser 5.1.0 (5.3.0 available)
pubspec_parse 1.2.1 (1.2.2 available)
source_maps 0.10.11 (0.10.12 available)
sse 4.1.1 (4.1.2 available)
test 1.22.0 (1.24.0 available)
test_api 0.4.16 (0.5.0 available)
test_core 0.4.20 (0.5.0 available)
vm_service 9.4.0 (11.3.0 available)
web_socket_channel 2.2.0 (2.3.0 available)
webdriver 3.0.1 (3.0.2 available)
Got dependencies in ../../opt/homebrew/Caskroom/flutter/3.7.8/flutter/packages/flutter_tools!
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.8, on macOS 13.3 22E252 darwin-arm64 (Rosetta), 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 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
✗ 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)
Scanning for devices is taking a long time...[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 3 categories.
X가 떴다고 걱정할 필요 없어요. 하나씩 차근차근 해결해 나가면 되니까요.
Xcode 이슈 해결
만약 제 포스팅의 Xcode 설치 방법을 확인하지 않으신 경우 이런 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
......
간단하게 Flutter에게 사용할 Xcode를 알려주면 처리가 됩니다. 명령어 2줄이면 돼요.
### 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.
CocoaPods 이슈 해결
이제 CocoaPods 이슈를 처리합니다.
설치
Homebrew를 사용해서 간단하게 설치를 진행합니다.
% brew install cocoapods
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
==> Fetching dependencies for cocoapods: libyaml, ca-certificates, openssl@1.1, readline and ruby
==> Fetching libyaml
.......
==> Installing cocoapods dependency: libyaml
==> Pouring libyaml--0.2.5.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/libyaml/0.2.5: 10 files, 351.3KB
==> Installing cocoapods dependency: ca-certificates
==> Pouring ca-certificates--2023-01-10.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺 /opt/homebrew/Cellar/ca-certificates/2023-01-10: 3 files, 216.9KB
==> Installing cocoapods dependency: openssl@1.1
==> Pouring openssl@1.1--1.1.1t.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openssl@1.1/1.1.1t: 8,101 files, 18MB
==> Installing cocoapods dependency: readline
==> Pouring readline--8.2.1.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/readline/8.2.1: 50 files, 1.7MB
==> Installing cocoapods dependency: ruby
==> Pouring ruby--3.2.1.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/ruby/3.2.1: 16,570 files, 46.8MB
==> Installing cocoapods
==> Pouring cocoapods--1.12.0.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/cocoapods/1.12.0: 13,436 files, 27.8MB
==> Running `brew cleanup cocoapods`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
설치 확인
CocoaPods가 잘 설치되었는지 확인해봅니다.
% 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) ### CocoaPods 이슈 해결
[✓] 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 2 categories.
CocoaPods 이슈가 없어지고 Xcode 관련 이슈가 완전히 처리되었어요.
개발 환경 설정하기
이제 Android Studio와 SDK를 설치해서 남은 오류를 해결해야해요. 아! 그 전에 Java도 설치를 해야겠군요.
💡 MacOS에 Flutter 개발 환경 세팅하기 - feat. Homebrew에서 전체 설치 방법을 확인하실 수 있습니다.
- Xcode, iOS Simulator
- Homebrew
- iTerm2
- Visual Studio Code
- Flutter
- CocoaPods
- Java
- Android Studio, Android SDK, Android Emulator
'DEV > Flutter' 카테고리의 다른 글
Flutter - iOS 시스템 설정에 Flutter 앱 설정 추가하기 (0) | 2023.10.19 |
---|---|
Flutter Build Runner - Filesystem Error 대응 방법 (0) | 2023.08.29 |
Flutter Database - NoSQL Hive 사용하기 (0) | 2023.04.21 |
Flutter State Management, 상태 관리는 어떻게 할까? (0) | 2023.04.20 |
[Firebase & iOS Xcode Build Error] Cloud Firestore Package 설치 후 Xcode Build가 너~~무 느려서 진행이 안되는 문제 해결 방법 (0) | 2022.08.17 |
Android Emulator에서 한글 키보드 사용하기 (0) | 2022.07.23 |
Flutter에서 Firestore Database 사용하기 (0) | 2022.07.20 |
Flutter & Firebase - Authentication State 구독 메소드 (0) | 2022.07.18 |