因为重装了系统,所以cocoapods也要重新装,所以记录下遇到的坑,真的是坑。网上找了很多资料,含泪弄了好几天。。发觉网上资料有些都过时了,所以自己整理下。
[!] Error installing SDWebImage[!] /usr/bin/git clone https://github.com/rs/SDWebImage.git /var/folders/pd/stntxywd0jx1fvws8fhj41tw0000gn/T/d20180727-6706-60dyxb --template= --single-branch --depth 1 --branch 4.0.0Cloning into '/var/folders/pd/stntxywd0jx1fvws8fhj41tw0000gn/T/d20180727-6706-60dyxb'...error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54fatal: The remote end hung up unexpectedlyfatal: early EOFfatal: index-pack failed
这个坑是因为pod install遇到,最后知道因为我开了vpn,关掉再pod install就可以了。。
[!] Error installing MBProgressHUD[!] /usr/bin/git clone https://github.com/matej/MBProgressHUD.git /var/folders/pd/stntxywd0jx1fvws8fhj41tw0000gn/T/d20180801-15423-eucoy0 --template= --single-branch --depth 1 --branch 1.0.0Cloning into '/var/folders/pd/stntxywd0jx1fvws8fhj41tw0000gn/T/d20180801-15423-eucoy0'...error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60fatal: The remote end hung up unexpectedly
执行$:xcode-select -p,打印结果如下:/Applications/Xcode.app/Contents/Developer,再执行$:sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
[!] CocoaPods could not find compatible versions for pod "Masonry": In Podfile: Masonry (~> 1.1.0)None of your spec sources contain a spec satisfying the dependency: `Masonry (~> 1.1.0)`.You have either: * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
这个坑是clone的一个项目,然后执行pod install遇到。主要还是~/.cocoapods/repos文件下的master的问题,可以执行pod setup,不过我从没成功过,所以要Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master,或者下载好master文件(这个文件好大坨的)然后移动到~/.cocoapods/repos下。
[!] CocoaPods could not find compatible versions for pod "Masonry": In snapshot (Podfile.lock): Masonry (= 1.1.0, ~> 1.1.0) In Podfile: Masonry (~> 1.1.0) None of your spec sources contain a spec satisfying the dependencies: `Masonry (~> 1.1.0), Masonry (= 1.1.0, ~> 1.1.0)`. You have either: * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile. Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
这个也是clone来的项目执行pod install的,把.xcworkspace和Podfile.lock文件删除,重新pod install一下就好了。猜测是不是不通版本或者系统造成的。
[!] Error installing SDWebImage [!] /usr/bin/git clone https://github.com/rs/SDWebImage.git /var/folders/pd/stntxywd0jx1fvws8fhj41tw0000gn/T/d20180801-17253-133nbmi --template= --single-branch --depth 1 --branch 3.8.2 Cloning into '/var/folders/pd/stntxywd0jx1fvws8fhj41tw0000gn/T/d20180801-17253-133nbmi'... fatal: unable to access 'https://github.com/rs/SDWebImage.git/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
这是在执行pod install之后发生的,解决办法:sudo gem install cocoapods,接着再pod install,就成功了。
git clone early EOF error
git config --global core.compression -1
fatal: The remote end hung up unexpectedly
将http.postBuffer设置的尽量大,例如git config --global http.postBuffer 524288000 (500M)
git config --global http.postBuffer 1048576000 (1G)
ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.
更新ruby
ERROR: While executing gem … (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj
sudo gem install -n /usr/local/bin cocoapods
[!] /bin/bash -c set -eVERSION="1.0.2j"SDKVERSION=`xcrun --sdk iphoneos --show-sdk-version 2> /dev/null`MIN_SDK_VERSION_FLAG="-miphoneos-version-min=7.0"BASEPATH="${PWD}"CURRENTPATH="/tmp/openssl"ARCHS="i386 x86_64 armv7 armv7s arm64"DEVELOPER=`xcode-select -print-path`mkdir -p "${CURRENTPATH}"mkdir -p "${CURRENTPATH}/bin"cp "file.tgz" "${CURRENTPATH}/file.tgz"cd "${CURRENTPATH}"tar -xzf file.tgzcd "openssl-${VERSION}"for ARCH in ${ARCHS}do CONFIGURE_FOR="iphoneos-cross" if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] ; then PLATFORM="iPhoneSimulator" if [ "${ARCH}" == "x86_64" ] ; then CONFIGURE_FOR="darwin64-x86_64-cc" fi else sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c" PLATFORM="iPhoneOS" fi export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please stand by..." export CC="${DEVELOPER}/usr/bin/gcc -arch ${ARCH} ${MIN_SDK_VERSION_FLAG}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" LIPO_LIBSSL="${LIPO_LIBSSL} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libssl.a" LIPO_LIBCRYPTO="${LIPO_LIBCRYPTO} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libcrypto.a" ./Configure ${CONFIGURE_FOR} --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile" make >> "${LOG}" 2>&1 make all install_sw >> "${LOG}" 2>&1 make clean >> "${LOG}" 2>&1doneecho "Build library..."rm -rf "${BASEPATH}/lib/"mkdir -p "${BASEPATH}/lib/"lipo -create ${LIPO_LIBSSL} -output "${BASEPATH}/lib/libssl.a"lipo -create ${LIPO_LIBCRYPTO} -output "${BASEPATH}/lib/libcrypto.a"echo "Copying headers..."rm -rf "${BASEPATH}/opensslIncludes/"mkdir -p "${BASEPATH}/opensslIncludes/"cp -RL "${CURRENTPATH}/openssl-${VERSION}/include/openssl" "${BASEPATH}/opensslIncludes/"cd "${BASEPATH}"echo "Building done."echo "Cleaning up..."rm -rf "${CURRENTPATH}"echo "Done."cp: file.tgz: No such file or directory
这是安装OpenSSL(RSA加密)所用的库用cocoapods安装时遇到的坑,大概意思就是路径不对,然后找了好久,终于用如下方法搞定:
1 设置header search paths,用pods是"${PODS_ROOT}/Headers/Public/OpenSSL"
2 设置Always Search User Paths(Deprecated) 为YES
顺便贴一点可能用到的命令:
Mac os 11以后的话安装cocoapods
$ sudo gem install -n /usr/local/bin cocoapods
cocoapods master移除:
$ sudo rm -fr ~/.cocoapods/repos/master
替代pod setup:
$ git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
$ pod repo update
pod安装与否查询(1为安装成功,0为不成功)
$ pod repo list
清空全局缓存
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
$ sudo rm -fr Pods/
很久没更新,发现系统升级之后,pod install 不能用了,会报如下错误:
-bash: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
需要执行:
sudo gem install -n /usr/local/bin cocoapods
待补充...
因为是事后才记录的,所以有些坑没有截图或者文字记录了,还有的解决完忘记记录,甚至可能有遗漏和错误。。。希望有道友可以评论补充以帮助更多踩坑人~
其他大佬踩坑记录:
CocoaPods安装、卸载、使用说明(Mac ox 10.11+)
rvm、Ruby环境和CocoaPods安装使用及相关报错问题解决
解决CocoaPods各种慢的方案(gem换源+pod repo换源)
cocoapod重装的话参考链接:
2017/10/1更新之MAC安装CocoaPods流程详解
温馨提醒,可以不用完全按照步骤,比如ruby已经装了且是最新的了,就没必要再去重装更新了。