macOS更新,CocoaPods问题 /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framewor...

万恶的os更新导致。。。。

问题记录:

1. /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

2.ERROR:  While executing gem ... (Gem::Exception)

    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

3.ERROR:  While executing gem ... (Gem::Exception) 下其他问题

4.一切os更新万恶问题都解决在于重装ruby环境,gem更新,gem源  ,处理逻辑==先更新gem再重装Cocoapods,不行就重装ruby环境

==解决方法:(看自己需要而定)

查看当地ruby版本:$ ruby -v

卸载当前ruby版本或者重装 $ rvm uninstall 2.3.8  reinstall 2.3.8

安装新版ruby $ rvm install 2.6.3 --disable-binary

指定ruby版本 $ rvm use ruby -2.6.3

验证ruby版本 $ ruby -v

安装CocoaPods $ sudo gem install cocoapods

建立本地仓库 $ pod setup (看自己需要)

工程项目pods $ pod install --repo-update

可能遇到问题:[!] CDN: trunk Repo update failed - 6 error(s):

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.0.1/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

解决:Podfile 添加 source 'https://github.com/CocoaPods/Specs.git'

后面是操作一堆命令,花里胡哨记录一下

Last login: Thu Mar  5 12:00:21 on ttys000

xuanmeijian@xunxunxun ~ % $pod setup

zsh: command not found: setup

xuanmeijian@xunxunxun ~ % 

xuanmeijian@xunxunxun ~ % pod setup

zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

xuanmeijian@xunxunxun ~ % 

xuanmeijian@xunxunxun ~ % 

xuanmeijian@xunxunxun ~ % pod setup

zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

xuanmeijian@xunxunxun ~ % 

xuanmeijian@xunxunxun ~ % sudo gem install -n /usr/local/bin CocoaPods

Password:

ERROR:  While executing gem ... (Gem::Exception)

    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

xuanmeijian@xunxunxun ~ % ruby -v

ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-darwin19]

xuanmeijian@xunxunxun ~ % gem use 2.6.3

ERROR:  While executing gem ... (Gem::CommandLineError)

    Unknown command use

xuanmeijian@xunxunxun ~ % remove 2.3.8

zsh: command not found: remove

xuanmeijian@xunxunxun ~ % gem remove 2.3.8

ERROR:  While executing gem ... (Gem::CommandLineError)

    Unknown command remove

xuanmeijian@xunxunxun ~ % cd /Users/xuanmeijian/Desktop/PodSuccees 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % pod install

zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % pods install

zsh: command not found: pods

xuanmeijian@xunxunxun PodSuccees % pod -v

zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory

xuanmeijian@xunxunxun PodSuccees % rvm uninstall 2.3.8

ruby-2.3.8 - #already gone

xuanmeijian@xunxunxun PodSuccees % rvm install 2.6.3 --disable-binary 

Already installed ruby-2.6.3.

To reinstall use:

    rvm reinstall ruby-2.6.3

xuanmeijian@xunxunxun PodSuccees %  rvm use ruby -2.6.3

Unrecognized command line flag: '-2.6.3'

Run `rvm help` to see usage information

xuanmeijian@xunxunxun PodSuccees % rvm use ruby-2.6.3

Using /Users/xuanmeijian/.rvm/gems/ruby-2.6.3

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % ruby -v

ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % sudo gem install cocoapods

Password:

Successfully installed cocoapods-1.9.0

Parsing documentation for cocoapods-1.9.0

Done installing documentation for cocoapods after 1 seconds

1 gem installed

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % pod setup

Setup completed

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % pod -v

[!] Unknown command: `-v`

Did you mean: env?

Usage:

    $pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache        Manipulate the CocoaPods cache

    + deintegrate  Deintegrate CocoaPods from your project

    + env          Display pod environment

    + init          Generate a Podfile for the current directory

    + install      Install project dependencies according to versions from a

                    Podfile.lock

    + ipc          Inter-process communication

    + lib          Develop pods

    + list          List pods

    + outdated      Show outdated project dependencies

    + plugins      Show available CocoaPods plugins

    + repo          Manage spec-repositories

    + search        Search for pods

    + setup        Setup the CocoaPods environment

    + spec          Manage pod specs

    + trunk        Interact with the CocoaPods API (e.g. publishing new specs)

    + try          Try a Pod!

    + update        Update outdated project dependencies and create new Podfile.lock

Options:

    --silent        Show nothing

    --version      Show the version of the tool

    --verbose      Show more debugging information

    --no-ansi      Show output without ANSI codes

    --help          Show help banner of specified command

xuanmeijian@xunxunxun PodSuccees % pod search AFNetworking

Creating search index for spec repo 'cocoapods'.. Done!

[!] CDN: trunk Repo update failed - 6 error(s):

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.0.1/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.1.1/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.1.2/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.1.4/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.1.6/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/e/1/AFNetworking-RACExtensions/0.1.8/AFNetworking-RACExtensions.podspec.json Response: Timeout was reached

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % pod install

Analyzing dependencies

[!] CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/5/5/c/IQKeyboardManagerSwift/6.5.5/IQKeyboardManagerSwift.podspec.json Response: Timeout was reached

xuanmeijian@xunxunxun PodSuccees % vim Podfile

xuanmeijian@xunxunxun PodSuccees % pod install

[!] Invalid `Podfile` file: syntax error, unexpected tCONSTANT, expecting end

pod 'IQKeyboardManagerSwift'

     ^~~~~~~~~~~~~~~~~~~~~~

/Users/xuanmeijian/Desktop/PodSuccees/Podfile:8: unterminated string meets end of file.

 #  from /Users/xuanmeijian/Desktop/PodSuccees/Podfile:7

 #  -------------------------------------------

 #  source 'https://github.com/CocoaPods/Specs.git

 >  pod 'IQKeyboardManagerSwift'

 #  end

 #  -------------------------------------------

xuanmeijian@xunxunxun PodSuccees % vim Podfile

xuanmeijian@xunxunxun PodSuccees % pod install

Analyzing dependencies

[!] Unable to find a specification for `IQKeyboardManagerSwift`

You have either:

 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.

 * mistyped the name or version.

 * not added the source repo that hosts the Podspec to your Podfile.

xuanmeijian@xunxunxun PodSuccees % pod install --repo-update

Updating local specs repositories

  $ /usr/bin/git -C /Users/xuanmeijian/.cocoapods/repos/cocoapods fetch origin

  --progress

  remote: Enumerating objects: 42633, done.       

  remote: Counting objects: 100% (42633/42633), done.       

  remote: Compressing objects: 100% (44/44), done.       

  remote: Total 261326 (delta 42601), reused 42588 (delta 42588), pack-reused 218693       

  Receiving objects: 100% (261326/261326), 29.88 MiB | 40.00 KiB/s, done.

  Resolving deltas: 100% (180941/180941), completed with 9231 local objects.

  From https://github.com/CocoaPods/Specs

     a633e4116b5..02f6ce6cb8e  master      -> origin/master

   * [new branch]              orta-patch-1 -> origin/orta-patch-1

  $ /usr/bin/git -C /Users/xuanmeijian/.cocoapods/repos/cocoapods rev-parse

  --abbrev-ref HEAD

  master

  $ /usr/bin/git -C /Users/xuanmeijian/.cocoapods/repos/cocoapods reset --hard

  origin/master

  Checking out files: 100% (397274/397274), done.

  HEAD is now at 02f6ce6cb8e [Add] AppLovinMediationByteDanceAdapter 2.8.0.1.0

Analyzing dependencies

Downloading dependencies

Installing IQKeyboardManagerSwift (6.5.5)

Generating Pods project

Integrating client project

[!] Please close any current Xcode sessions and use `PodSuccees.xcworkspace` for this project from now on.

Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

xuanmeijian@xunxunxun PodSuccees % 

xuanmeijian@xunxunxun PodSuccees % 

你可能感兴趣的:(macOS更新,CocoaPods问题 /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framewor...)