首先mac环境变量的配置,mac系统
在~/下创建./zshrc 文件,在文件里添加source ~/.bash_profile命令
.bash_profile文件的修改不能立马生效,需要执行source ~/.bash_profile,且只在当前终端窗口中生效。当关闭当前终端窗口后失效。
先百度安装好brew,然后brew update,brew install ruby,安装好后要新的ruby生效需要找到brew安装的ruby的位置,我的在/opt/homebrew/Cellar/ruby/3.2.2/bin
配置方法就是在.base_profile中写上
export PATH="/opt/homebrew/Cellar/ruby/3.2.2/bin:$PATH"
立即生效的话source ~/.base_profile
安装cocospods,sudo gem install cocoapods
要pod命令生效,同样配置pod的环境变量
export PATH="/opt/homebrew/lib/ruby/gems/3.2.0/bin:$PATH"