Reinstall CocoaPod on macOS

created at 11-14-2021 views: 41

Uninstall CocoaPod

The terminal executes the following commands

sudo gem uninstall cocoapods

Check the installed plugins related to cocoapods

gem list --local | grep cocoapods

Uninstall related plugins one by one (e.g.cocoapods-core)

sudo gem uninstall cocoapods-core

Reinstall CocoaPod

The terminal executes the following commands

sudo gem install -n /usr/local/bin cocoapods

View version number

pod --version

Update local .cocoapods/repos

pod repo update --verbose

CocoaPod pushes components to a remote warehouse (

Precautions for making framework

  • Build Settings-Architectures

Build Settings

  • Build Settings -Linking

Build Settings

cd to the root directory of the HandyScanner.podspec file
1) Local verification of HandyScanner.podspec file content standardization

pod lib lint --verbose --allow-warnings

2) Online verification of the tag version of the remote component warehouse and the tag consistency of the local version to be released

⚠️After practice, after tagging here, you need to wait for a few minutes, otherwise the error message "Cannot find the release version of the corresponding tag" is always reported.

pod spec lint --verbose --allow-warnings

3) Publish/update components to CocoaPods warehouse (

pod trunk push HandyScanner.podspec --verbose --allow-warnings

If the project has a private static library, you need to add the following commands


After practice, the version posted here is subject to the notice issued by the mailbox. Using pod search HandyScanner may not be able to search for the latest version; (most of the reasons are cocoapod local cache and `` server time difference); Open the official website in the browser, search and verify that the version number is not immediately updated at this time;
After the update, cd to any pod management project, fill in the latest version just released,
pod'HandyScanner', ‘0.2.9’, the terminal executes the following commands, there is a high probability that this problem can be effectively solved;

pod install --repo-update

4) Delete the component (specified version) from the CocoaPods warehouse (

pod trunk delete HandyScanner 0.0.1

5) HandyScanner.podspec format and content do |spec|         = "HandyScanner"
  spec.version      = "0.2.8"
  spec.license      = "MIT"

  spec.summary      = "A lightweight scanning component based on system API in Swift5"
  spec.description  = <<-DESC
             No memory leaks, Support scaling, Support light sense to automatically turn on the flash, Support auto zoom, Support custom UI.
                      DESC       = { "Charlie" => "" }
  spec.homepage     = ""
  spec.source       = { :git => "", :tag => spec.version }

  spec.requires_arc = true

  spec.swift_version = "5.0"
  spec.platform      = :ios, "11.0"
  spec.ios.deployment_target = "11.0"

  spec.static_framework = true
  spec.ios.vendored_frameworks  = 'lib/HandyScannerSDK.framework'
  spec.source_files  = "lib/HandyScannerSDK.framework/**/*"
  spec.public_header_files = 'lib/HandyScannerSDK.framework/Headers/HandyScannerSDK-Swift.h'

  # ======================================================
  # spec.ios.exclude_files = 'lib/xxxx.dec' (忽略的文件)
  # spec.source_files  = 'lib/HandyScannerSDK.framework/**/*'(资源文件)
  # spec.public_header_files = 'lib/HandyScannerSDK.framework/Headers/HandyScannerSDK-Swift.h'(Object-CExpose the header file)
  # ======================================================

# * Match all types of files
# *.{h,m} matches all files ending in .h and .m
# ** Match all subdirectories

created at:11-14-2021
edited at: 11-14-2021: