最近升級的mac os 12 在執(zhí)行pod安裝時厂庇,出現(xiàn)如下 錯誤:
Ignoring ffi-1.15.3 because its extensions are not built. Try: gem pristine ffi --version 1.15.3
/usr/local/Cellar/cocoapods/1.10.2/libexec/gems/cocoapods-1.10.2/lib/cocoapods/command.rb:128:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: active developer path (\"/Applications/Xcode12.app/Contents/Developer\") does not exist\nUse `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.\nSee `man xcode-select` for more details.\n") (RuntimeError)
...
于是在網(wǎng)上搜索相關(guān)的內(nèi)容,各種折騰就是沒好输吏,最后是在stackoverflow
上找到的解決方法权旷,供有相似情況的同學參考 https://stackoverflow.com/questions/20939568/error-error-installing-cocoapods-error-failed-to-build-gem-native-extension 。
這個貼子列出各種答案贯溅,我經(jīng)過嘗試拄氯,使用了下面的方法才解決。
xcode-select --reset
sudo xcode-select --switch /Library/Developer/CommandLineTools
sudo gem install -n /usr/local/bin cocoapods