在 macOS Big Sur 上安装可可豆荚时出错

Posted

技术标签:

【中文标题】在 macOS Big Sur 上安装可可豆荚时出错【英文标题】:Error installing cocoa pods on macOS Big Sur 【发布时间】:2021-03-24 15:43:27 【问题描述】:

我正在我的机器上设置颤振。但是,当我尝试使用安装 cocoapods 时

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.15.0/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 ./siteconf20210324-1667-1wwdce5.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... yes
checking for ffi_prep_cif_var()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
creating extconf.h
creating Makefile

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/ext/ffi_c
make "DESTDIR="
make: *** No rule to make target `"/Volumes/macOS', needed by `AbstractMemory.o'.  Stop.

make failed, exit code 2

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

这是由于分区名称中包含“空格”这一事实引起的吗?我安装操作系统的驱动器名称是“macOS Big Sur”,而 Flutter 位于另一个分区“macOS Storage”

有人可以帮忙吗?

【问题讨论】:

我在这里使用@Alsh 编译器修复了这个问题***.com/questions/63650689/… 【参考方案1】:

这将通过以下方式解决:

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

如果您需要安装CocoaPods 1.10.0 +,您可以使用HomeBrew 并在命令行中使用以下命令:

brew install cocoapods

【讨论】:

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4 为我工作。不再需要“brew install cocopods”。【参考方案2】:

我在 BigSur 下遇到了同样的错误, 当我尝试以传统方式安装可可时,我发现了一件奇怪的事情。 https://cocoapods.org 地址给出“内部服务器错误”。这意味着可可服务器出现问题。所以我打算用 home-brew 安装新版本的可可。

我使用上面的代码将 home-brew 安装到 Mac。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

然后,我使用下面的命令卸载了当前的旧版本 cocoapods

sudo gem uninstall cocoapods 

然后,我使用自制软件安装了新版本的可可豆荚,

brew install cocoapods  

然后,我使用下面的命令来修复不一致的地方。

brew link --overwrite cocoapods

还有胜利:)

【讨论】:

以上是关于在 macOS Big Sur 上安装可可豆荚时出错的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Homebrew 在 macOS Big Sur 上安装 PHP 7.2?

安装MacOS Big Sur的艰苦历程

Xdebug 安装失败,因为使用 MAMP 在 macOS Big Sur 上“phpize”失败

错误:命令“clang”失败,退出状态为 1:在 MacOS Big Sur M1 上安装熊猫

在 Big Sur 上安装密码学时出现 Pip 错误

在 macOS Big Sur 11.2.3 上安装 ruby​​、rails 和 postgresql 时安装 xcode 的问题