卸载cocoapods权限问题

2019-10-09  本文已影响0人  Smallwolf_JS
Apple@AppledeMacBook-Pro WebRtc4iOS % sudo gem uninstall cocoapods     
Remove executables:
    pod, sandbox-pod

in addition to the gem? [Yn]  Y
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.
AppledeMacBook-Pro:cc_ios Apple$ sudo gem uninstall cocoapods -n /usr/local/bin
Password:
Remove executables:
    pod, sandbox-pod

in addition to the gem? [Yn]  Y
Removing pod
Removing sandbox-pod
Successfully uninstalled cocoapods-1.8.3
AppledeMacBook-Pro:cc_ios Apple$ sudo gem uninstall cocoapods -n /usr/local/bin

pod install出现问题

Apple@AppledeMacBook-Pro cc_ios % pod install                                  
Analyzing dependencies
Traceback (most recent call last):
    34: from /usr/local/bin/pod:23:in `<main>'
    33: from /usr/local/bin/pod:23:in `load'
    32: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/bin/pod:55:in `<top (required)>'
    31: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:52:in `run'
    30: from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    29: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/command/install.rb:52:in `run'
    28: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:156:in `install!'
    27: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
    26: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/user_interface.rb:64:in `section'
    25: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
    24: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:410:in `analyze'
    23: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    22: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:984:in `resolve_dependencies'
    21: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/user_interface.rb:64:in `section'
    20: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:985:in `block in resolve_dependencies'
    19: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:177:in `sources'
    18: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:177:in `map'
    17: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
    16: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/sources_manager.rb:19:in `find_or_create_source_with_url'
    15: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:386:in `source_with_url'
    14: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:58:in `all'
    13: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:24:in `aggregate'
    12: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:324:in `aggregate_with_repos'
    11: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:324:in `map'
    10: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:324:in `block in aggregate_with_repos'
     9: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:315:in `source_from_path'
     8: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:310:in `block in source_from_path'
     7: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/manager.rb:310:in `new'
     6: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/cdn_source.rb:29:in `initialize'
     5: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source.rb:31:in `initialize'
     4: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/cdn_source.rb:55:in `refresh_metadata'
     3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source.rb:434:in `refresh_metadata'
     2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/metadata.rb:28:in `from_file'
     1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/metadata.rb:28:in `new'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source/metadata.rb:15:in `initialize': undefined method `with_indifferent_access' for #<String:0x00007f91a4dfb898> (NoMethodError)
    25: from /usr/local/bin/pod:23:in `<main>'
    24: from /usr/local/bin/pod:23:in `load'

升级ruby 重装cocoapods

1.安装cocoapods
sudo gem install cocoapods----会提示没有写入的权限

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

也可以使用brew install cocoapods---建议使用这种命令安装,会解决上面的问题
需要使用新的命令
sudo gem install -n /usr/local/bin cocoapods

2.source的管理和查看
gem sources --remove https://rubygems.org/---删除
gem sources -a http://ruby.taobao.org/---增加
gem sources -l---查看源

3.卸载cocoapods
sudo gem uninstall -n /usr/local/bin cocoapods
4.更新ruby
sudo gem update --system
5.删除cocoapods
gem list --local | grep cocoapods---查看本地安装过的cocopods相关东西
然后使用命令逐个删除
sudo gem uninstall cocoapods-core
打开cocoapods安装的目录
open ~/.cocoapods/repos
which pod---查看pod路径输出/usr/local/bin/pod
移除Cocoapods组件,继续执行 sudo rm -rf + 路径
6.查看版本号
pod --version或者gem list查看gem下所有的版本

上一篇下一篇

猜你喜欢

热点阅读