본문 바로가기
프로그래밍/세팅 및 오류

[Flutter] Flutter Doctor / Xcode CocoaPods not installed. / sudo gem install cocoapods 설치 안되는 오류

by 노잼인간이라불립니다 2023. 2. 1.

1. Flutter로 앱을 만들기 위해 Flutter를 설치하던 중 오류가 발생했다.

 flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.0, on macOS 12.6.3 21G419 darwin-arm64, locale
    ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[!] 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 (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2022.2.1)
[✓] IntelliJ IDEA Community Edition (version 2022.2.1)
[✓] VS Code (version 1.74.2)
[✓] Connected device (2 available)
    ! Device emulator-5554 is offline.
    ! Device emulator-5556 is offline.
[✓] HTTP Host Availability

 

2. Xcode를 설치했으나 CocoaPods라는게 필요한가 보다. 그래서 시키는데로 명령어를 입력.

 sudo gem install cocoapods
Password:
Fetching tzinfo-2.0.6.gem
Fetching fuzzy_match-2.0.4.gem
Fetching i18n-1.12.0.gem
Fetching algoliasearch-1.27.5.gem
Fetching nap-1.1.0.gem
Fetching httpclient-2.8.3.gem
Fetching zeitwerk-2.6.6.gem
Fetching typhoeus-1.4.0.gem
Fetching netrc-0.11.0.gem
Fetching ffi-1.15.5.gem
Fetching ethon-0.16.0.gem
Fetching activesupport-6.1.7.2.gem
Fetching addressable-2.8.1.gem
Fetching concurrent-ruby-1.2.0.gem
Fetching claide-1.1.0.gem
Fetching public_suffix-4.0.7.gem
Fetching cocoapods-trunk-1.6.0.gem
Fetching molinillo-0.8.0.gem
Fetching cocoapods-plugins-1.0.0.gem
Fetching cocoapods-search-1.0.1.gem
Fetching cocoapods-core-1.11.3.gem
Fetching cocoapods-try-1.2.0.gem
Fetching cocoapods-downloader-1.6.3.gem
Fetching cocoapods-deintegrate-1.0.5.gem
Fetching fourflusher-2.3.1.gem
Fetching nanaimo-0.3.0.gem
Fetching rexml-3.2.5.gem
Fetching xcodeproj-1.22.0.gem
Fetching atomos-0.1.3.gem
Fetching gh_inspector-1.1.3.gem
Fetching escape-0.0.4.gem
Fetching colored2-3.1.2.gem
Fetching ruby-macho-2.5.1.gem
Fetching cocoapods-1.11.3.gem
Successfully installed concurrent-ruby-1.2.0
Successfully installed i18n-1.12.0
Successfully installed tzinfo-2.0.6
Successfully installed zeitwerk-2.6.6
Successfully installed activesupport-6.1.7.2
Successfully installed nap-1.1.0
Successfully installed fuzzy_match-2.0.4
Successfully installed httpclient-2.8.3
A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
	ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20230201-10783-us4kz7.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
	--with-ffi_c-dir
	--without-ffi_c-dir
	--with-ffi_c-include
	--without-ffi_c-include=${ffi_c-dir}/include
	--with-ffi_c-lib
	--without-ffi_c-lib=${ffi_c-dir}/lib
	--enable-system-libffi
	--disable-system-libffi
	--with-libffi-config
	--without-libffi-config
# If you come from bash you might have to change your $PATH.
	--with-pkg-config
	--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in `block in try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in `try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
	from extconf.rb:9:in `system_libffi_usable?'
	from extconf.rb:42:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/gem_make.out

3. 제대로 설치가 되지 않는다. 여러가지 방법을 시도 했으나 성공한 명령어는~~~ 바로 cocoaPods을 brew로 설치하라는 것.

 brew cleanup -d -v
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-lfs.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/pyenv.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/pkg-config.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/gh.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/gdbm.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/mpdecimal.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/icu4c.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/readline.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/openjdk@17.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/lz4.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/ruby-install.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/sqlite.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/zlib.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/xz.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/gradle.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-flow.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/libfido2.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/ca-certificates.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/gettext.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/libcbor.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/zstd.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/autoconf.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/mono.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/m4.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/pcre2.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/libevent.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/openssl@1.1.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/python@3.10.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/zsh-syntax-highlighting.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/protobuf.rb
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::TapLoader): loading /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/git.rb
Removing: /opt/homebrew/Cellar/ca-certificates/2022-10-11... (3 files, 225.5KB)
Warning: Skipping gettext: most recent version 0.21.1 not installed
Warning: Skipping gh: most recent version 2.22.1 not installed
Warning: Skipping git: most recent version 2.39.1 not installed
Removing: /Users/byungsangjo/Library/Caches/Homebrew/git-flow--0.4.1_1... (24.6KB)
Warning: Skipping gradle: most recent version 7.6 not installed
Removing: /opt/homebrew/Cellar/icu4c/71.1... (262 files, 76.8MB)
Removing: /opt/homebrew/Cellar/libcbor/0.9.0... (31 files, 180KB)
Removing: /opt/homebrew/Cellar/libfido2/1.12.0... (538 files, 1.3MB)
Warning: Skipping openjdk@17: most recent version 17.0.6 not installed
Warning: Skipping pcre2: most recent version 10.42 not installed
Removing: /opt/homebrew/Cellar/protobuf/21.8... (279 files, 19.2MB)
Warning: Skipping pyenv: most recent version 2.3.12 not installed
Removing: /opt/homebrew/Cellar/sqlite/3.39.4... (11 files, 4.4MB)
Removing: /opt/homebrew/Cellar/xz/5.2.7... (95 files, 1.5MB)
Removing: /Users/byungsangjo/Library/Caches/Homebrew/git_bottle_manifest--2.37.3... (11.4KB)
Removing: /Users/byungsangjo/Library/Caches/Homebrew/git-flow_bottle_manifest--0.4.1_1... (1.8KB)
==> This operation has freed approximately 103.6MB of disk space.
 brew install cocoapods
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
==> Fetching dependencies for cocoapods: libyaml and ruby
==> Fetching libyaml
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:a436da33a0
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching ruby
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/manifests/3.2.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/blobs/sha256:4617eb7c595c4
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Fetching cocoapods
==> Downloading https://ghcr.io/v2/homebrew/core/cocoapods/manifests/1.11.3_1-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/cocoapods/blobs/sha256:9717ff53
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for cocoapods: libyaml and ruby
==> Installing cocoapods dependency: libyaml
==> Pouring libyaml--0.2.5.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libyaml/0.2.5: 10 files, 353KB
==> Installing cocoapods dependency: ruby
==> Pouring ruby--3.2.0.arm64_monterey.bottle.tar.gz
🍺  /opt/homebrew/Cellar/ruby/3.2.0: 16,574 files, 46.8MB
==> Installing cocoapods
==> Pouring cocoapods--1.11.3_1.arm64_monterey.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/cocoapods/1.11.3_1: 13,476 files, 27.9MB
==> Running `brew cleanup cocoapods`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

4. Xcode 관련 오류가 해결 되었다. 다음은 안드로이드 스튜디오 오류 해결하러 가야지...

 flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.0, on macOS 12.6.3 21G419 darwin-arm64, locale ko-KR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (version 2022.1)
    ✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2022.2.1)
[✓] IntelliJ IDEA Community Edition (version 2022.2.1)
[✓] VS Code (version 1.74.2)
[✓] Connected device (2 available)
    ! Device emulator-5554 is offline.
    ! Device emulator-5556 is offline.
[✓] HTTP Host Availability