When I tried to import Realm with CocoaPods like this:
pod install --verbose --no-repo-update
then error happened:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/ColinH/PEGTL' into submodule path '/private/var/folders/51/tzbm7yqs3bsck5vxz3xj5pkc0000gn/T/d20160925-2957-1pu1dou/Realm/ObjectStore/external/pegtl' failed
why?
3 Answers 3
The above error is mainly caused by the change of the security mechanism of os10.11+ and cocoapods1.0+ version upgrade. Mainly in the pod setup process. And the waiting time for this process is very long
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
The same effect as pod setup
Mac OS 10.11, some cocoapods commands to change. If you have a pod setup or pod update problem, and it is difficult to solve, I suggest 10.11. Uninstall reinstall after installation of cocoapods has some different commands, the following summary:
1 check the ruby environment, if necessary, please update as follows
$ sudo gem update --system
2 uninstall cocoapods
$ sudo gem uninstall cocoapods
3 reinstall cocoapods (Setup command has changed)
Before 10.11
$ sudo gem install cocoapods
After 10.11
$ sudo gem install -n /usr/local/bin cocoa pods
4
$ sudo chmod +rx /usr/local/bin
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
//taking CocoaPods Specs repository copy to your computer under directory ~/.cocoapods
pod setup
Comments
I was facing a similar error while installing pods, but I traced some resources and useful links, which clearly indicates that your should be fast enough to download and install the pods. So, for that, I have just created shell script which always repeats the same command
like pod update if it's a failure, repeat the command else command run successfully.
This is shell script code:
#!/bin/bash
Define the command you want to execute
command_to_run="pod update"
Loop until the command executes successfully
while true; do # Execute the command $command_to_run
# Check the exit status of the command
if [ $? -eq 0 ]; then
echo "Command executed successfully."
break
else
echo "Command failed. Retrying..."
fi
done
This code snippet is used for all shell commands that need to be repeated whenever they fail.
Thank you.