zsh: command not found: pod

반응형
728x90
반응형
 
Introduction

   xcode를 이용하여 개발할 때, pod가 필요합니다. pod를 사용하기위해 pod init 명령 등이 필요합니다. 하지만, 명령을 수행할 경우. 'zsh: command not found: pod’ 오류가 발생하게 됩니다. 발생하게 된 오류의 원인을 확인하고, 해결 방안을 찾아보도록 하겠습니다.
 
 
문제점이 뭘까?

 
 
macbook을 초기화하고, 이것저것 개발 환경을 다시 셋팅하기 시작하였습니다. 기억에(?) 설치를 여러번 하다보니, 설치가 안되었을 경우도 있지만, 제대로 설치가 되지 않은 경우이지 않을까? 합니다. 
현재 개발환경은 다음과 같습니다. 
 
Envrionments
  • MacOS: Catalina (10.15.7 version)
  • MacBook Air 13 / mid 2012
 
일단은 재설치를 해보도록 하겠습니다. 터미널을 이용하여 다음 명령어를 수행합니다. 
$ sudo gem install cocoapods
 
터미널에서는 다음과 같은 결과를 획득하였습니다. 
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.13.1/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 ./siteconf20201008-3744-mhkcq5.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
    --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-19/2.6.0/ffi-1.13.1/mkmf.log


extconf failed, exit code 1


Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.13.1/gem_make.out
 
설치가 안되네요? cocoapods을 설치하는 방법은 gem을 이용한 방법과 homebrew를 이용한 방법이 있습니다. stackoverflow를 찾아보니, 다음과 같이 gem에서 cocoapods을 제거하고 brew를 이용하여 설치를 하였습니다. 그 결과 pod 명령이 수행됩니다. 

 

 

 
cocoapods Install by homebrew

 
터미널에서 다음의 명령어를 순차적으로 수행합니다. 
$ gem list | grep cocoapods
$ gem uninstall cocoapods
$ brew install cocoapods
 
 
설치가 완료되면 cocoapods 이 설치가 되었는지 확인을 하기위해 다음의 명령어를 수행합니다. 
$ pod
 
 
상위 결과와 같이 pod 명령이 수행되면 이후 cocoapods을 이용하여 Library를 추가 및 실행 가능합니다. 
 
 
 
 
 
 
 
728x90
반응형

댓글

Designed by JB FACTORY