SolvedCocoaPods pod install fails with json error on Mac OS X 10.15

Report

What did you do?

Run pod install

What did you expect to happen?

Install all pod dependencies correctly.

What happened instead?

Error

JSON::ParserError - 767: unexpected token at ''
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/json/common.rb:156:in `parse'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/specification.rb:715:in `from_string'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/specification.rb:689:in `from_file'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.8.3/lib/cocoapods-core/source.rb:186:in `specification'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/delegate.rb:348:in `block in delegating_block'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/delegate.rb:349:in `block in delegating_block'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/resolver.rb:178:in `dependencies_for'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:18:in `block in dependencies_for'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:17:in `dependencies_for'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:807:in `block in group_possibilities'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:806:in `reverse_each'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:806:in `group_possibilities'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:778:in `possibilities_for_requirement'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:295:in `initial_state'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:210:in `start_resolution'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:168:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:986:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:984:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:410:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:234:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:233:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/installer.rb:156:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.8.3/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

[!] Oh no, an error occurred.

CocoaPods Environment

Stack

   CocoaPods : 1.8.3
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15 (19A583)
       Xcode : 11.0 (11A420a)
         Git : git version 2.21.0 (Apple Git-122)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ 1c2166dafdefb92c37d284027f796d73403f8fb4
               trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'

target 'test213' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for test213
  # pod 'Apollo', '~> 0.15'
  pod 'AWSS3'

  target 'test213Tests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'test213UITests' do
    # Pods for testing
  end

end

Project that demonstrates the issue

Make new porject in xcode, do 'pod init' add pods and do 'pod install'

19 Answers

✔️Accepted Answer

I did
rm -rf ~/.cocoapods/repos/trunk/
After that it worked again.

Other Answers:

I did
rm -rf ~/.cocoapods/repos/trunk/
After that it worked again.

same problem!
But that not work for me!

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Command

/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/bin/pod install

Report

    What did you do?

    What did you expect to happen?

    What happened instead?

Stack

   CocoaPods : 1.9.0
        Ruby : ruby 2.7.0preview1 (2019-05-31 trunk c55db6aa271df4a689dc8eb0039c929bf6ed43ff) [x86_64-darwin19]
    RubyGems : 3.1.0.pre1
        Host : Mac OS X 10.15.3 (19D76)
       Xcode : 11.3.1 (11C504)
         Git : git version 2.21.1 (Apple Git-122.3)
Ruby lib dir : /Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

Podfile

platform :ios, '9.0'

use_frameworks!

target 'xxxx' do

### 第三方服务组件
# 极光推送
pod 'JPush'
# 友盟
pod 'UMCCommon'
pod 'UMCAnalytics'
pod 'UMCShare/UI'
pod 'UMCShare/Social/ReducedWeChat'
pod 'UMCShare/Social/ReducedQQ'
pod 'UMCShare/Social/Sina'
# 百度地图及定位
pod 'BaiduMapKit'
pod 'BMKLocationKit'
# 乐播投屏
pod 'LBLelinkKit', '30210'
# 阿里云短视频
pod 'AliyunVideoSDKBasic'
pod 'AlivcConan'
pod 'VODUpload'
pod 'QuCore-ThirdParty'

### 开源框架
pod 'SnapKit'
pod 'QMUIKit'
pod 'Moya/RxSwift'
pod 'Kingfisher'
pod 'MJRefresh'
pod 'HandyJSON'
pod 'SwiftDate'
pod 'RxSwift'
pod 'RxCocoa'
pod 'RxDataSources'
pod 'ReachabilitySwift'
pod 'SwiftKeychainWrapper'
pod 'CHIPageControl/Jaloro'
pod 'FSPagerView'
pod 'RealmSwift'
pod 'YYText'

end

Error

JSON::ParserError - 785: unexpected token at ''
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/2.7.0/json/common.rb:156:in `parse'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/2.7.0/json/common.rb:156:in `parse'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification.rb:742:in `from_string'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/specification.rb:716:in `from_file'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-core-1.9.0/lib/cocoapods-core/source.rb:186:in `specification'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver/lazy_specification.rb:29:in `subspec_by_name'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:362:in `block in specifications_for_dependency'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:362:in `map'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:362:in `specifications_for_dependency'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:165:in `search_for'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:267:in `each'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:267:in `sort_by'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:53:in `block in sort_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:70:in `with_no_such_dependency_error_handling'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/delegates/specification_provider.rb:52:in `sort_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:288:in `initial_state'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:210:in `start_resolution'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:168:in `resolve'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/resolver.rb:94:in `resolve'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:410:in `analyze'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/installer.rb:156:in `install!'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/command/install.rb:52:in `run'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/lib/cocoapods/command.rb:52:in `run'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.9.0/bin/pod:55:in `<top (required)>'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/bin/pod:23:in `load'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/bin/pod:23:in `<main>'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/bin/ruby_executable_hooks:24:in `eval'
/Users/xxxx/.rvm/rubies/ruby-2.7.0-preview1/bin/ruby_executable_hooks:24:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

you also need delete ~/.cocoapods/repos/Spec_Lock and rm -rf ~/.cocoapods/repos/trunk/ ,then it work.

I did
rm -rf ~/.cocoapods/repos/trunk/
After that it worked again.

It working for me. Thank you

I did
rm -rf ~/.cocoapods/repos/trunk/
After that it worked again.

nice!! thanks

More Issues: