zoukankan      html  css  js  c++  java
  • cocoapods 更新

    总共就下面几个命令行

    sudo gem update -n /usr/local/bin --system
    gem source -l
    gem sources --remove 上面返回的路径
    gem source -a https://gems.ruby-china.org/
    sudo gem install -n /usr/local/bin cocoapods
    pod setup
    pod --version
    pod search AFNetWorking
    

    以下是有可能出现的问题

    1.升级Ruby环境

    gem update --system
    

    1.1若报错

    ERROR:  While executing gem ... (Gem::FilePermissionError)
        You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
    

    命令行换成

    sudo gem update --system
    

    1.2若报错

    ERROR:  While executing gem ... (Errno::EPERM)
        Operation not permitted - /usr/bin/update_rubygems
    

    命令行换成

    sudo gem update -n /usr/local/bin --system
    

    1.3 若报错

    YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
    

    ruby 版本过低,更新ruby , 第一次通过RVM失败,换成了Homebrew安装成功了

    方式一: RVM方式安装

    参照 ruby china wiki

    // 1.先安装ruby版本管理器RVM
    
    curl -L get.rvm.io | bash -s stable
    
    // 2.验证RVM
    
    source ~/.profile
    source ~/.bashrc
    source ~/.bash_profile
    
    // 3.测试是否安装正常
    
    rvm -v
    
    // 4.查看ruby最新版本
    
    rvm list known
    
    // 5.安装ruby 2.4.1
    
     rvm install 2.4.1
    
    

    方式二: Homebrew安装ruby

    // 1.安装 Homebrew
    
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
    若报错
    
    error: could not lock config file /usr/local/Homebrew/.git/config: Permission denied
    
    执行
    
    sudo chgrp -R admin /usr/local
    sudo chmod -R g+w /usr/local
    
    或
    
    sudo chown -R $(whoami) /usr/local
    
    
    [参考链接] (https://apple.stackexchange.com/questions/42127/homebrew-permissions-multiple-users-needing-to-brew-update)
    
    若报错
    
    Error: /usr/local/Cellar is not writable. You should change the 
    ownership and permissions of /usr/local/Cellar back to your 
    
    执行
    sudo chown -R $(whoami) /usr/local/Cellar
    
    // 2.验证brew是否安装成功
    
    brew
    
    安装成功后,会返回
    Example usage: 
    brew search [TEXT|/REGEX/] 
    brew (info|home|options) [FORMULA…] 
    brew install FORMULA… 
    brew update 
    brew upgrade [FORMULA…] 
    brew uninstall FORMULA… 
    brew list [FORMULA…]
    
    // 3.更新最新版本brew
    
    brew update
    
    // 4.安装 ruby, 通过下面的命令会安装最新的ruby版本
    
    brew install ruby
    
    // 5.安装后查看ruby版本还是老版本
    
    source ~/.profile
    source ~/.bash_profile
    
    

    1.4若报错

    ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
    ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
    

    请升级ruby

    2.更换Ruby镜像

    // 检查现有 Ruby镜像
    gem sources -l
    如果结果是 
    *** CURRENT SOURCES ***
    https://gems.ruby-china.org/
    就不需要替换了,否则就要替换,执行下面命令
    // 移除现有镜像
    gem sources --remove https://rubygems.org
    // 添加国内镜像
    gem source -a https://gems.ruby-china.org/
    // 检查是否替换成功
    gem sources -l
    

    3.安装 Cocoapods

    sudo gem install cocoapods
    若出现
    ERROR:  While executing gem ... (Gem::FilePermissionError)
        You don't have write permissions for the /usr/bin directory.
    则换成下面的命令行
    sudo gem install -n /usr/local/bin cocoapods
    

    4.建立索引库

    pod setup
    

    5.查看版本

    pod --version
    

    6.pod search AFNetworking

    若报错

     [!] Unable to find a pod with name, author, summary, or description matching `AFNetworking`
    

    执行命令行

    rm  ~/Library/Caches/CocoaPods/search_index.json
    

    然后再执行 pod search AFNetworking ,会重新建立索引,需要花费一会时间

  • 相关阅读:
    Dingo/api 学习笔记
    Composer install 报错
    bootstrap4 调整元素之间距离
    css font-family常用的黑体宋体等字体中英文对照
    mac 开关机
    lodash.memoize
    Evevt Loop 事件循环
    mac 安装 XX-Net-3.12.11
    mac端口占用
    npm 安装/删除/发布/更新/撤销 发布包
  • 原文地址:https://www.cnblogs.com/shidaying/p/8338089.html
Copyright © 2011-2022 走看看