简体   繁体   English

如何在 M1 上安装 pod

[英]How do I install pod on M1

I am currently getting this issue when installing podfile.我目前在安装 podfile 时遇到此问题。 I've been trying to install pod install, but It keeps failing.我一直在尝试安装 pod install,但它一直失败。 The error message is below.错误消息如下。

You may have encountered a bug in the Ruby interpreter or extension libraries.您可能在 Ruby 解释器或扩展库中遇到了错误。 Bug reports are welcome.欢迎提交错误报告。 For details: https://www.ruby-lang.org/bugreport.html [IMPORTANT] Don't forget to include the Crash Report log file under DiagnosticReports directory in bug reports.有关详细信息: https://www.ruby-lang.org/bugreport.html [重要] 不要忘记在错误报告中包含 DiagnosticReports 目录下的崩溃报告日志文件。 enter image description here在此处输入图像描述

M1 is compatible to arm, so when performing arch related commands, it is operated under arm64. M1兼容arm,所以在执行arch相关命令时,是在arm64下运行的。 so an architecture will be set to x86_64 to install ffi.所以架构将设置为 x86_64 来安装 ffi。

sudo arch -x86_64 gem install ffi

M1 should indicates x86_64 when installing pod on M1 Macbook, cause to be synchronize on an architecture.在 M1 Macbook 上安装 pod 时,M1 应指示 x86_64,导致在架构上同步。

arch -x86_64 pod install

follow steps按照步骤

  1. remove the pod移除吊舱

    $ sudo gem install cocoapods-deintegrate cocoapods-clean $ sudo gem install cocoapods-deintegrate cocoapods-clean

    $ pod deintegrate $ pod 解体

    $ pod cache clean --all $ pod cache clean --all

    $ rm Podfile $ rm Podfile

2.Install pod 2.安装吊舱

Right-click on Terminal in Finder Get Info Open with Rosetta I installed a gem that seems to be related to the symbol not found in the error:在 Finder 中右键单击终端 Get Info Open with Rosetta 我安装了一个似乎与错误中未找到的符号相关的 gem:

sudo gem install ffi

If using M1 and don't want to enter arch -x86-64 everytime, you can use this command to install ffi instead:如果使用 M1 并且不想每次都输入arch -x86-64 ,可以使用此命令安装ffi代替:

gem install --user-install ffi -- --enable-libffi-alloc

And then it should be able to run pod install without it.然后它应该能够在没有它的情况下运行pod install Using sudo might be needed.可能需要使用sudo

Reference参考

Open applications folder and find Terminal in Utilities folder and right click on it and select get info and check Open Using Rosetta打开应用程序文件夹并在实用程序文件夹中找到终端并右键单击它并 select 获取信息并检查使用 Rosetta 打开

在此处输入图像描述

Then follow the regular intel cocoapod installation it will work.然后按照常规的英特尔 cocoapod 安装即可

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM