Solve the problem of “pod install” – forever wait

2017-06-20

When we use pod install to initialize our cocoaPods IOS project. You may stuck at the following (which you have to use control+C to stop the process):

1
2
3
HanslendeMacBook-Pro:~ Hanslen$ pod install
Updating local specs repositories
^C[!] Cancelled

If you google this forever wait problem, some answers will let you try this command instead:
pod install --verbose --no-repo-update
However, this will not throughly solve the problem, you may face the new forever wait at: (same for using control+C to stop the process)

1
2
3
4
5
6
7
HanslendeMacBook-Pro:~ Hanslen$ pod install --verbose --no-repo-update
Preparing
Creating shallow clone of spec repo `master-1` from `https://github.com/CocoaPods/Specs.git`
$ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master-1 --depth=1
Cloning into 'master-1'...
^C[!] Cancelled

By trying a lot of answers on the Stackoverflow, the following in one works for me:

  1. pod repo remove master
  2. pod setup

Here, you may have a message indicating that your cocoaPods version is too old. (By using pod --version you can check your version)

1
2
3
4
5
6
HanslendeMacBook-Pro:~ Hanslen$ pod setup
Setting up CocoaPods master repo
[!] The `master` repo requires CocoaPods 1.0.0 - (currently using 0.39.0)
Update CocoaPods, or checkout the appropriate tag in the repo.
HanslendeMacBook-Pro:~ Hanslen$ pod --version
0.39.0

To update the cocoaPods, you need sudo gem install cocoapods. Also, you may face another problem like:

1
2
3
4
HanslendeMacBook-Pro:~ Hanslen$ sudo gem install cocoapods
......... (omitting some message)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

If this error occurs, try this one sudo gem install -n /usr/local/bin cocoapods.
Then, type pod --version again, you will have the latest version. Then try pod setup again, you may meet a new problem (…SE is full of meeting new problem and fixing it…)

1
2
3
4
HanslendeMacBook-Pro:~ Hanslen$ pod setup
Setting up CocoaPods master repo
Performing a deep fetch of the `master` specs repo to improve future performance
^C[!] Cancelled

Type this command: sudo rm -fr ~/.cocoapods/repos/master
And then pod setup. It should work, you are downloading the relevant files from git…
Finally, try pod install
Your origin problem “forever wait” should be fixed.


Comments: