Cocopod 降版本

本文是复制了-Coder_JMicheal 发表的文章,方便以后自己查看

有时我们需要降低CocoaPods版本来解决某些第三方库的兼容问题,例如RestKit不兼容CocoaPods的0.39.0版本,降级到0.38.2就OK了。

1.移除RubyGems中的Cocoapods程序包

查看gems中本地程序包,执行如下命令:

$ gem list

输出如下:

*** LOCAL GEMS ***

activesupport (5.1.4, 4.2.10)
addressable (2.5.2)
atomos (0.1.2)
babosa (1.0.2)
bigdecimal (1.3.2, default: 1.2.8)
bundler (1.16.1)
CFPropertyList (3.0.0, 2.2.8)
claide (1.0.2)
cocoapods (1.5.3, 1.2.0)
cocoapods-core (1.5.3, 1.2.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.2.0, 1.1.3)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
cocoapods-try (1.1.0)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
concurrent-ruby (1.0.5)
declarative (0.0.10)
declarative-option (0.1.0)
did_you_mean (1.0.0)
domain_name (0.5.20180417)
dotenv (2.3.0)
emoji_regex (0.1.1)
escape (0.0.4)
excon (0.62.0)
faraday (0.15.0)
faraday-cookie_jar (0.0.6)
faraday_middleware (0.12.2)
fastimage (2.1.1)
fastlane (2.92.1)
ffi (1.9.23)
fourflusher (2.0.1)
fuzzy_match (2.1.0, 2.0.4)
gh_inspector (1.1.3)
google-api-client (0.15.0, 0.13.6)
googleauth (0.6.2)
highline (1.7.10)
http-cookie (1.0.3)
httpclient (2.8.3)
i18n (0.9.5)
io-console (0.4.6, default: 0.4.5)
json (2.1.0, default: 1.8.3.1)
jwt (2.1.0)
libxml-ruby (2.9.0)
little-plugger (1.1.4)
logging (2.2.2)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_magick (4.8.0, 4.5.1)
mini_portile2 (2.3.0)
minitest (5.10.3, 5.8.5)
molinillo (0.6.5, 0.5.7)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.5)
nap (1.1.0)
naturally (2.1.0)
net-telnet (0.1.1)
netrc (0.11.0)
nokogiri (1.8.1, 1.5.6)
os (1.0.0, 0.9.6)
plist (3.4.0)
power_assert (1.1.0, 0.2.6)
psych (2.2.4, default: 2.1.0.1)
public_suffix (3.0.0, 2.0.5)
rake (12.1.0, 10.4.2)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
rdoc (5.1.0, default: 4.2.1)
representable (3.0.4)
retriable (3.1.1)
rouge (3.0.0, 2.0.7)
ruby-macho (1.1.0, 0.2.6)
rubygems-update (2.6.14)
rubyzip (1.2.1)
sass (3.5.6)
sass-listen (4.0.0)
security (0.1.3)
signet (0.8.1)
simctl (1.6.4)
slack-notifier (2.3.2)
sqlite3 (1.3.13, 1.3.11)
terminal-notifier (1.8.0)
terminal-table (1.8.0)
test-unit (3.2.6, 3.1.5)
thread_safe (0.3.6)
tty-cursor (0.5.0)
tty-screen (0.6.4)
tty-spinner (0.8.0)
tzinfo (1.2.5)
uber (0.1.0)
unf (0.1.4)
unf_ext (0.0.7.5)
unicode-display_width (1.3.2)
word_wrap (1.0.0)
xcodeproj (1.5.7)
xcpretty (0.2.8)
xcpretty-travis-formatter (1.0.0)

其中包含的CocoaPods版本:

cocoapods (1.5.3, 1.2.0)

移除指定版本cocoapods如1.2.0,执行如下命令:

sudo gem uninstall cocoapods -v 1.2.0

成功删除则输出:

Successfully uninstalled cocoapods-1.2.0

2.安装指定版本的Cocoapods程序包

安装指定版本的CocoaPods 如1.5.3,执行如下命令:

sudo gem install cocoapods -v 1.5.3

注:若不指定版本,即命令如sudo gem install cocoapods则默认安装最新版。

部分可能会出现以下问题:

Fetching: cocoapods-core-1.5.3.gem (100%)
Successfully installed cocoapods-core-1.5.3
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 -v 1.5.3

安装成功后,执行命令查看版本号:

pod --version

输出:

1.5.3

你可能感兴趣的:(Cocopod 降版本)