MAC 安装 flutter (苹果 M1 M2 芯片的配置) 多个flutter控制 fvm安装使用

使用brew安装

brew tap leoafarias/fvm
在执行

brew install fvm 等待下载完成 就可以通过fvm命令安装管理flutter了
fvm list 查看已安装的flutter 版本

fvm install 版本号 --- 安装指定版本的flutter

fvm use 版本号 切换指定版本的flutter

​JDK 安装

https://blog.csdn.net/weixin_48088839/article/details/124387437

下载文件 并解压这里我走了很多坑,因为我这里是 m 系列芯片,所以一直配置不成功,少了 zsh 的配置

https://flutter.cn/docs/development/tools/sdk/releases?tab=macos
这里我解压复制到了--访达->应用程序里面
打开.bash_profile文件编辑 ,如果没有的话vim ~/.bash_prifile,如果又的话姐可以使用open ~/.bash_profile记事本编辑
如果使用vim 步骤 按 i键打开编辑模式,复制下面的文件。完成后输入 :wq 注意,:wq这个冒号也就是:前面有个空格这是必须的保存,再刷新配置
source ~/.bash_profile
配置环境变量

export PATH="${PATH}:${ANDROID_HOME}/tools"
export PATH="${PATH}:${ANDROID_HOME}/platform-tools"
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn" 
export PATH="${PATH}:/Applications/flutter/bin"
 如果你的终端是苹果芯片也就是m系列的话,还需要增加一个步骤
 执行open ~/.zshrc
 如果没有执行vim ~/.zshrc 复制上面bash_prifile文件的内容 再保存完成后输入 :wq ,zhixing  苏入册~、。zshrc
 显示执行m命令flutter -h 或者flutter doctor 正常显示了

flutter 报错

Xcode - develop for iOS and macOS (Xcode 14.2)

sudo gem install cocoapods 执行这个命令
如果上面命令还是有问题执行下面
brew install cocoapods
pod setup
如果还是报错 System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21: warning: Insecure world writable dir /opt/homebrew/bin in PATH, mode 040777
ERROR:  Error installing cocoapods:
The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 6.1.7.3. Try installing it with `gem install activesupport -v 6.1.7.3` and then running the current command again
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

​解决此问题,你需要执行以下步骤:

  1. 使用 Homebrew 安装更新版的 Ruby:
brew install ruby
    1. 将新版 Ruby 添加到 PATH 环境变量中:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
  1. 如果你使用的是 Zsh 终端,则应该将上方命令的 “.bash_profile” 替换为 “.zshrc”。

  2. 加载.bash_profile 或.zshrc 文件:

source ~/.bash_profile   
source ~/.zshrc

  1. 现在,你可以使用 gem 工具安装最新版本的 CocoaPods 了:
sudo gem install cocoapods

    1. 最后,更新 CocoaPods 的 repo 库:
pod repo update

如果上面还是不行 gem-install-activesupport-v 6.1.7.3 然后在执行sudo gem install cocoapods 就可以了

Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

.运行 flutter doctor --android-licenses,提示安装某些确实插件,输入Y,多次询问,输入y

fvm 安装

shiyong使用brew install fvm安装

fvm 的命令行需要使用sudo 权限才能操作比如安装
sudo fvm istall 3.x.xx
切换
sudo fvm use 3.x.x
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

初遇你时动了情

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值