유니티 iOS 빌드 오류 - Failed to install CocoaPods for the current user.

2023. 3. 29. 00:56Unity

유니티 iOS 빌드 오류 - Failed to install CocoaPods for the current user.

 

 

Failed to install CocoaPods for the current user.
It will not be possible to install Cocoapods in the generated Xcode project which will result in link errors when building your application.
For more information see:
  https://guides.cocoapods.org/using/getting-started.html
'gem install cocoapods --user-install' failed with code (1):
WARNING:  You don't have /Users/build/.gem/ruby/2.6.0/bin in your PATH,
 gem executables will not run.
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied @ rb_sysopen - /Users/build/.gem/ruby/2.6.0/gems/ffi-1.15.5/CHANGELOG.md

sudo로도 실패함

 

문제 해결

먼저 brew를 통해 rbenv 를 설치합니다

brew update
brew install rbenv ruby-build

설치할 수 Ruby 버전은 다음 명령으로 확인할 수 있습니다.

rbenv install -l
rbenv install 2.6.4
rbenv global 2.6.4

rbenv PATH를 추가하기 위해 본인의 쉘 설정 파일 (..zshrc, .bashrc) 을 열어 다음의 코드를 추가합니다.
저는 zsh를 사용하니 .zshrc에 추가합니다.

 

 

vim ~/.zshrc
[[ -d ~/.rbenv  ]] && \
  export PATH=${HOME}/.rbenv/bin:${PATH} && \
  eval "$(rbenv init -)"
source ~/.zshrc