Error installing cocoapods: cocoapods-core requires Ruby version >= 2.6. The current ruby version is 2.5.8.224.

Cocoapods 依赖 Ruby,Ruby 我是用 rvm 管理的,rvm 更新又遇到报错:Could not download rvm-installer, please report to https://github.com/rvm/rvm/issues
使用 curl 又遇到报错:curl: (60) SSL certificate problem: certificate has expired

问题最终也解决了,好事多磨吧!
遇到这类问题,不能急,需要耐心的按照它的报错信息去一步步解决就行!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
$ ruby -v
ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-darwin18]

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [13:20:41]
$ pod -v
/Library/Ruby/Site/2.3.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.3.0/rubygems.rb:308:in `activate_bin_path'
from /usr/local/bin/pod:23:in `<main>'

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [13:22:29] C:1
$ gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.com/

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [13:23:33]
$ sudo gem install cocoapods
Password:
ERROR: Error installing cocoapods:
There are no versions of cocoapods-core (= 1.11.2) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
cocoapods-core requires Ruby version >= 2.6. The current ruby version is 2.5.8.224.

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [13:25:46] C:1
$ rvm -v
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:11:43]
$ rvm get stable --auto-dotfiles
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Downloading https://get.rvm.io
Could not download rvm-installer, please report to https://github.com/rvm/rvm/issues

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:13:46] C:60
$ curl google.com
curl: (7) Failed to connect to google.com port 80: Operation timed out

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:16:08] C:7
$ export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:20:04]
$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:20:08]
$ rvm get stable --auto-dotfiles
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Downloading https://get.rvm.io
Could not download rvm-installer, please report to https://github.com/rvm/rvm/issues

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:20:14] C:60
$ rvm get stable --auto-dotfiles
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Downloading https://get.rvm.io
Could not download rvm-installer, please report to https://github.com/rvm/rvm/issues

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:23:33] C:60
$ curl -sSL https://get.rvm.io | bash -s stable
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:24:43]
$ code ~/.curlrc

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:37:04]
$ echo insecure >> ~/.curlrc

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:39:35]
$ HOMEBREW_CURLRC=1

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:40:04]
$ export HOMEBREW_CURLRC

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:40:53]
$ curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/ganzhixiong/.rvm/
RVM PATH line found in /Users/ganzhixiong/.mkshrc /Users/ganzhixiong/.profile /Users/ganzhixiong/.bashrc.
RVM PATH line not found for Zsh, rerun this command with '--auto-dotfiles' flag to fix it.
RVM sourcing line found in /Users/ganzhixiong/.profile /Users/ganzhixiong/.bash_profile /Users/ganzhixiong/.zlogin.
Upgrade of RVM in /Users/ganzhixiong/.rvm/ is complete.

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate



# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:41:12]
$ rvm -v
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:41:47]
$ rvm reload
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
RVM reloaded!

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:43:44]
$ rvm -v
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:43:53]
$ rvm get stable
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Downloading https://get.rvm.io
No GPG software exists to validate rvm-installer, skipping.
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/ganzhixiong/.rvm/
RVM PATH line found in /Users/ganzhixiong/.mkshrc /Users/ganzhixiong/.profile /Users/ganzhixiong/.bashrc.
RVM PATH line not found for Zsh, rerun this command with '--auto-dotfiles' flag to fix it.
RVM sourcing line found in /Users/ganzhixiong/.profile /Users/ganzhixiong/.bash_profile /Users/ganzhixiong/.zlogin.
Upgrade of RVM in /Users/ganzhixiong/.rvm/ is complete.

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate


RVM reloaded!

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:44:34]
$ rvm get stable --auto-dotfiles
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Downloading https://get.rvm.io
No GPG software exists to validate rvm-installer, skipping.
Turning on auto dotfiles mode.
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/ganzhixiong/.rvm/
Removing rvm PATH line from /Users/ganzhixiong/.mkshrc /Users/ganzhixiong/.profile /Users/ganzhixiong/.bashrc.
Adding rvm PATH line to /Users/ganzhixiong/.profile /Users/ganzhixiong/.mkshrc /Users/ganzhixiong/.bashrc /Users/ganzhixiong/.zshrc.
Removing rvm loading line from /Users/ganzhixiong/.profile /Users/ganzhixiong/.bash_profile /Users/ganzhixiong/.zlogin.
Adding rvm loading line to /Users/ganzhixiong/.profile /Users/ganzhixiong/.bash_profile /Users/ganzhixiong/.zlogin.
Upgrade of RVM in /Users/ganzhixiong/.rvm/ is complete.

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate


RVM reloaded!

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:51:23]
$ rvm -v
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:52:10]
$ rvm list known
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:53:46]
$ rvm list
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
=* ruby-2.5.8 [ x86_64 ]
ruby-2.6.6 [ x86_64 ]
ruby-2.7.2 [ x86_64 ]

# => - current
# =* - current && default
# * - default


# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:53:56]
$ rvm use 2.6.6 --default
Warning! PATH is not properly set up, /Users/ganzhixiong/.rvm/gems/ruby-2.5.8/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.5.8
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Using /Users/ganzhixiong/.rvm/gems/ruby-2.6.6

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:54:20]
$ rvm list
ruby-2.5.8 [ x86_64 ]
=* ruby-2.6.6 [ x86_64 ]
ruby-2.7.2 [ x86_64 ]

# => - current
# =* - current && default
# * - default


# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:54:24]
$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin18]

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:54:36]
$ sudo gem install cocoapods
Password:
Successfully installed cocoapods-1.11.2
Parsing documentation for cocoapods-1.11.2
Done installing documentation for cocoapods after 1 seconds
1 gem installed

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:55:44]
$ pod --version
1.11.2

# ganzhixiong @ ganzhixiongdeMacBook-Pro-3 in ~/Documents/blog on git:master x [17:56:16]
$ cat ~/.curlrc
insecure

Error installing cocoapods: cocoapods-core requires Ruby version >= 2.6. The current ruby version is 2.5.8.224.

https://ganzhixiong.com/p/5cfaa141/

Author

干志雄

Posted on

2021-11-14

Updated on

2021-11-14

Licensed under

Comments