自学内容网 自学内容网

解决macOS搭建flutter错误 CocoaPods not installed

浏览地址: https://guides.cocoapods.org/using/getting-started.html#installation

在这里插入图片描述

先安装gem:

brew install gem

在这里插入图片描述

根据提示,要安装Ruby:

brew install ruby

在这里插入图片描述

根据提示:

If you need to have ruby first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc

For compilers to find ruby you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"

进行如下配置:

export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/ruby/lib"
export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"

此时, 就有gem这个命令了:
在这里插入图片描述

安装命令:

sudo gem install cocoapods

这一步安装的东西比较多, 可能等待的时间比较长:
在这里插入图片描述

查看安装位置:

gem which cocoapods

再配一个环境变量:

export PATH="/Users/zhangdapeng/.local/share/gem/ruby/3.3.0/bin:$PATH"

最后执行下面的命令检查:

fluttor doctor

在这里插入图片描述


原文地址:https://blog.csdn.net/qq_37703224/article/details/142521387

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!