ruby 升级问题记录

iOS技术成长之路

Posted by DM on October 25, 2024

1.记录更新 ruby

https://www.jianshu.com/p/5311b94c6f12 1.解决办法 先卸载掉 homebrew 里面的 cocoapods: brew uninstall cocoapods 然后再用 gem 的方式安装: sudo gem install cocoapods 如果不报错就可以直接 pod install 了 如果报错,看下边:

问题 2:输入密码后发现又特么报错 :While executing gem … (Gem::FilePermissionError)

ERROR:Whileexecuting gem…(Gem::FilePermissionError)You don’t have write permissionsforthe/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0directory.mayonggang@mayonggang~% 解决问题 2:指定的 ruby 路径不对,应当使用更新版本的 ruby 安装 rbenv 指定使用 rbenv 的 gem 来执行 安装 rbenv $ rbenv install-l $ rbenv install-l2.6.102.7.63.0.43.1.2jruby-9.3.4.0mruby-3.0.0rbx-5.0truffleruby-22.1.0truffleruby+graalvm-22.1.0 -最新的是 3.1.2。但是我下载失败,换成了 3.1.1 就没事儿了 $ rbenv install3.1.1 指定 ruby 版本 $ rbenv global3.1.1$ rbenv rehash 查找 gem 路径 $ rbenv which gem/Users/用户名/.rbenv/versions/3.1.1/bin/gem 添加相关路径到 PATH 中 $ export PATH=”$HOME/.rbenv/versions/3.1.1/bin:$PATH” 然后再次 :sudo gem install cocoapods 就可以了 $ sudo gem install cocoapodsPassword:Fetching colored2-3.1.2.gemFetching claide-1.1.0.gemFetching CFPropertyList-3.0.5.gemFetching xcodeproj-1.21.0.gemFetching ruby-macho-2.5.1.gemFetching nanaimo-0.3.0.gemFetching atomos-0.1.3.gemFetching nap-1.1.0.gemFetching molinillo-0.8.0.gemFetching gh_inspector-1.1.3.gemFetching fourflusher-2.3.1.gemFetching escape-0.0.4.gemFetching cocoapods-try-1.2.0.gemFetching netrc-0.11.0.gem。。。 然后就可以开心的 pod install 了 如果有些常见的 SDK 找不到, [!]Unableto find a specificationfor…..或者[!]Unableto find a pod with name,author,summary,or description matching .... 那可能是需要更新一下 pod $ pod update 运行 pod install 时,如果在最后报错: [!]Anerror occurredwhileprocessing the post-install hook of thePodfile.Nosuch fileordirectory-python/Users/myg/Desktop/P_gitee/1.数字北京/Podfile:139:in``‘/Users/myg/Desktop/P_gitee/1.数字北京/Podfile:139:inblock(3levels)infrom_ruby'/Users/myg/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/podfile.rb:196:inpost_install!’/Users/myg/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:945:inrun_podfile_post_install_hook' 处理方法: 我的提示语是没有 python 这个文件路径, 我去 Podfile 中搜索了一下 output =python #{root_path}/DS_BeiJing/Third/BaiDuAI/scheme_desc_collector.py #{root_path} 2.ruby global 3.0.3 m1 指定版本不成功 https://www.jianshu.com/p/83b6eca16ab3 运行命令行:

CFLAGS=”-Wno-error=implicit-function-declaration” RUBY_CONFIGURE_OPTS=’–with-readline-dir=/usr/local/opt/readline/’ arch -x86_64 rbenv install 3.0.3

3.can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

4.ruby 数据源添加错误

ruby -v //当前 ruby 版本安装 2.7.2

rvm requirements

brew install libyaml

rvm pkg install openssl

rvm reinstall 2.7.2 –with-openssl-dir=$HOME/.rvm/usr/ssl