Cocoapods
//列表
gem list --local | grep cocoapods
//安装 https://www.jianshu.com/p/9b21c0069ca9
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/maste
补充
自己试着安装了下cocoapods。
cocoaPods 是iOS 第三方库 管理工具, 下面用 AFNetworking 练习。
cocoaPods 使用 Ruby(一位日本大牛开发的语言), macOS 默认支持。
1.aaa$ ruby -v
2.终端 输入 sudo gem update --system (成功更新 )(没有权限:$:sudo gem update -n --system
成功提示
Password:
Updating rubygems-update
Fetching: rubygems-update-2.5.0.gem (100%)
Successfully installed rubygems-update-2.5.0
Parsing documentation for rubygems-update-2.5.0
Installing ri documentation for rubygems-update-2.5.0
Installing darkfish documentation for rubygems-update-2.5.0
Parsing documentation for rubygems-update-2.5.0
Installing RubyGems 2.5.0
RubyGems 2.5.0 installed
Parsing documentation for rubygems-2.5.0
Installing ri documentation for rubygems-2.5.0
=== 2.4.8 / 2015-06-08
Bug fixes:
* Tightened API endpoint checks for CVE-2015-3900
------------------------------------------------------------------------------
RubyGems installed the following executables:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/gem
Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for ruby libraries. You may access it like this:
ri Classname
ri Classname.class_method
ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
--no-document flag, or set it as the default in your ~/.gemrc file. See
'gem help env' for details.
RubyGems system software updated
3.gem sources -l
aaaa$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org
gem sources -a https://gems.ruby-china.org https://ruby.taobao.org/
4.
在运行 “sudo gem install cocoapods” 的时候出现问题:ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/fuzzy_match
则可以改为:
sudo gem install -n /usr/local/bin cocoapods
输入密码
成功显示
2016.1.13
1.查找一个库(AFNetworking)
pod search AFNetworking
2.创建Podfile
//Object - C
platform :ios, '8.0'
target '自己的工程名字' do
pod 'AMap3DMap', '~> 4.0.2'
end
//Swift
platform :ios, '9.0'
use_frameworks!
target '自己的工程名字' do
pod 'Alamofire', '4.4.0'
end
3.
pod install 容易失败<墙> pod install 改为 pod install --verbose --no-repo-update
出现Setting up CocoaPods master repo,说明Cocoapods在将它的信息下载到 ~/.cocoapods里;
cd 到该目录里,用du -sh *命令来查看文件大小,每隔几分钟查看一次,这个目录最终大小是100多M,就是完成了
/****************************其他知识**********************************/ 2016-4- 26 ruby环境重新更新 <>里面的内容是终端显示的内容 1. Homebrew (https://zh.wikipedia.org/wiki/Homebrew) 下面整行都是 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 192:~ yuancheng$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" The current contents of /usr/local are bin CODEOFCONDUCT.md etc Library LICENSE.txt README.md share .git .github .gitignore > 192:~ yuancheng$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" The current contents of /usr/local are bin CODEOFCONDUCT.md etc Library LICENSE.txt README.md share .git .github .gitignore 192:~ yuancheng$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" Warning: This script will remove: /Library/Caches/Homebrew/ /usr/local/.git/ /usr/local/.github/ /usr/local/.gitignore /usr/local/.travis.yml /usr/local/.yardopts /usr/local/CODEOFCONDUCT.md /usr/local/LICENSE.txt /usr/local/Library/ /usr/local/README.md /usr/local/bin/brew /usr/local/etc/bash_completion.d/brew /usr/local/share/doc/homebrew/ /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew Are you sure you want to uninstall Homebrew? [y/N] N > 192:~ yuancheng$ brew doctor < Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks! Warning: Your Xcode (7.2.1) is outdated Please update to Xcode 7.3. Xcode can be updated from the App Store. 192:~ yuancheng$ curl -L https://get.rvm.io | bash -s stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 184 100 184 0 0 44 0 0:00:04 0:00:04 --:--:-- 44 100 22865 100 22865 0 0 1256 0 0:00:18 0:00:18 --:--:-- 4751 Downloading https://github.com/rvm/rvm/archive/1.27.0.tar.gz Downloading https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc', but no GPG software exists to validate it, skipping. Upgrading the RVM installation in /Users/yuancheng/.rvm/ RVM PATH line found in /Users/yuancheng/.mkshrc /Users/yuancheng/.profile /Users/yuancheng/.bashrc /Users/yuancheng/.zshrc. RVM sourcing line found in /Users/yuancheng/.profile /Users/yuancheng/.bash_profile /Users/yuancheng/.zlogin. Upgrade of RVM in /Users/yuancheng/.rvm/ is complete. # yuancheng, # # Thank you for using RVM! # We sincerely hope that RVM helps to make your life easier and more enjoyable!!! # # ~Wayne, Michal & team. In case of problems: https://rvm.io/help and https://twitter.com/rvm_io Upgrade Notes: * No new notes to display. > 192:~ yuancheng$ source ~/.rvm/scripts/rvm 192:~ yuancheng$ rvm -v < rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/] 192:~ yuancheng$ rvm install 2.0.0 Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.11/x86_64/ruby-2.0.0-p648. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for osx. Installing requirements for osx. Updating system..... Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libksba, openssl........ Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date. Requirements installation successful. Installing Ruby from source to: /Users/yuancheng/.rvm/rubies/ruby-2.0.0-p648, this may take a while depending on your cpu(s)... ruby-2.0.0-p648 - #downloading ruby-2.0.0-p648, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10.2M 100 10.2M 0 0 8262 0 0:21:45 0:21:45 --:--:-- 8210 ruby-2.0.0-p648 - #extracting ruby-2.0.0-p648 to /Users/yuancheng/.rvm/src/ruby-2.0.0-p648.... ruby-2.0.0-p648 - #applying patch /Users/yuancheng/.rvm/patches/ruby/ssl_no_v3.patch. ruby-2.0.0-p648 - #configuring................................................. ruby-2.0.0-p648 - #post-configuration. ruby-2.0.0-p648 - #compiling.......................................................................... ruby-2.0.0-p648 - #installing.............. ruby-2.0.0-p648 - #making binaries executable.. ruby-2.0.0-p648 - #downloading rubygems-2.4.8 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 154 100 154 0 0 45 0 0:00:03 0:00:03 --:--:-- 45 100 437k 100 437k 0 0 2264 0 0:03:17 0:03:17 --:--:-- 5895 ruby-2.0.0-p648 - #extracting rubygems-2.4.8.... ruby-2.0.0-p648 - #removing old rubygems......... ruby-2.0.0-p648 - #installing rubygems-2.4.8...................... ruby-2.0.0-p648 - #gemset created /Users/yuancheng/.rvm/gems/ruby-2.0.0-p648@global ruby-2.0.0-p648 - #importing gemset /Users/yuancheng/.rvm/gemsets/global.gems..|ruby-2.0.0-p648 - #generating global wrappers........ ruby-2.0.0-p648 - #gemset created /Users/yuancheng/.rvm/gems/ruby-2.0.0-p648 ruby-2.0.0-p648 - #importing gemsetfile /Users/yuancheng/.rvm/gemsets/default.gems evaluated to empty gem list ruby-2.0.0-p648 - #generating default wrappers........ ruby-2.0.0-p648 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). Install of ruby-2.0.0-p648 - #complete WARNING: Please be aware that you just installed a ruby that is no longer maintained (2016-02-24), for a list of maintained rubies visit: http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering Please consider upgrading to ruby-2.3.0 which will have all of the latest security patches. Ruby was built without documentation, to build it run: rvm docs generate-ri > 192:~ yuancheng$ rvm 2.0.0 —default < Unrecognized command line argument(s): '—default ' ( see: 'rvm usage' ) > 192:~ yuancheng$ rvm usage < = rvm * https://rvm.io/ * https://github.com/rvm/rvm/ == DESCRIPTION: RVM is the Ruby enVironment Manager (rvm). It manages Ruby application environments and enables switching between them. == Installation curl -L https://get.rvm.io | bash -s stable --autolibs=enabled [--ruby] [--rails] [--trace] stable :: Install stable RVM, good for servers. --ruby :: Additionally install latest ruby version (MRI). --rails :: Install gem rails into default gemset (also installs ruby=). --trace :: Print trace of the installation, gist output when you have problems. --autolibs :: Enable or disable autolibs see: https://rvm.io/rvm/autolibs More details here: https://rvm.io/rvm/install/ == Usage rvm [Flags] [Options] Action [Implementation[,Implementation[,...]] == Flags --default :: with 'rvm use X', sets the default ruby for new shells to X. --debug :: Toggle debug mode on for very verbose output. --disable-binary :: Install from source instead of using binaries --trace :: Toggle trace mode on to see EVERYTHING rvm is doing. --force :: Force install, removes old install & source before install. --summary :: Used with rubydo to print out a summary of the commands run. --latest :: with gemset --dump skips version strings for latest gem. --gems :: with uninstall/remove removes gems with the interpreter. --docs :: with install, attempt to generate ri after installation. --reconfigure :: Force ./configure on install even if Makefile already exists. --skip-gemsets :: with install, skip the installation of default gemsets. --quiet-curl :: Makes curl silent when fetching data --64 :: Option for installing 64-bit Rubies (default behavior) --32 :: Option for installing 32-bit Rubies == Options -v|--version :: Emit rvm version loaded for current shell -l|--level :: patch level to use with rvm use / install --bin :: path for binaries to be placed (~/.rvm/bin/) -S :: Specify a script file to attempt to load and run (rubydo) -e :: Execute code from the command line. --gems :: Used to set the 'gems_flag', use with 'remove' to remove gems --archive :: Used to set the 'archive_flag', use with 'remove' to remove archive --patch :: With MRI Rubies you may specify one or more full paths to patches for multiple, specify comma separated: --patch /.../.../a.patch[%prefix],/.../.../.../b.patch 'prefix' is an optional argument, which will be bypassed to the '-p' argument of the 'patch' command. It is separated from patch file name with '%' symbol. -C|--configure :: custom configure options. If you need to pass several configure options then append them comma separated: -C --...,--...,--... --nice :: process niceness (for slow computers, default 0) --ree-options :: Options passed directly to ree's './installer' on the command line. --with-rubies :: Specifies a string for rvm to attempt to expand for set operations. == Action (Note: for most actions, 'rvm help action-name' may provide more information.) *usage* :: show this usage information version :: show the rvm version installed in rvm_path use :: setup current shell to use a specific ruby version reload :: reload rvm source itself (useful after changing rvm source) implode :: (seppuku) removes the rvm installation completely. This means everything in $rvm_path (~/.rvm || /usr/local/rvm). This does not touch your profiles. However, this means that you must manually clean up your profiles and remove the lines which source RVM. get :: {head,stable} upgrades rvm to latest head or stable version. Check 'rvm help get' for more details. (If you experience bugs try this first with head version, then ask for help in #rvm on irc.freenode.net and hang around) reset :: remove current and stored default & system settings. (If you experience odd behavior try this second) info :: show the *current* environment information for current ruby current :: print the *current* ruby version and the name of any gemset being used. debug :: show info plus additional information for common issues install :: install one or many ruby versions See also: https://rvm.io/rubies/installing/ uninstall :: uninstall one or many ruby versions, leaves their sources remove :: uninstall one or many ruby versions and remove their sources reinstall :: reinstall ruby and runs gem pristine on all gems, make sure to read output, use 'all' for all rubies. migrate :: Lets you migrate all gemsets from one ruby to another. upgrade :: Lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically. wrapper :: generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like. cleanup :: Lets you remove stale source folders / archives and other miscellaneous data associated with rvm. repair :: Lets you repair parts of your environment e.g. wrappers, env files and similar files (e.g. general maintenance). fix-permissions :: Repairs broken permissions (e.g. by sudo or chef) osx-ssl-certs :: Helps update certificates for OpenSSL installed by rvm on OSX. snapshot :: Lets you backup / restore an rvm installation in a lightweight manner. alias :: Lets you set shortcut strings for convenience with 'rvm use'. disk-usage :: Tells you how much disk space rvm install is using. tools :: Provides general information about the ruby environment, primarily useful when scripting rvm. docs :: Tools to make installing ri and rdoc documentation easier. rvmrc :: Tools related to managing rvmrc trust and loading. patchset :: Tools related to managing ruby patchsets. do :: runs an arbitrary command against specified and/or all rubies cron :: Manages setup for using ruby in cron tasks. gemset :: gemsets: https://rvm.io/gemsets/ rubygems :: Switches the installed version of rubygems for the current ruby. config-get :: display values for RbConfig::CONFIG variables. gemdir :: display the path to the current gem directory (GEM_HOME). fetch :: Performs an archive / src fetch only of the selected ruby. list :: show currently installed rubies, interactive output. https://rvm.io/rubies/list/ autolibs :: Controls settings for automatically installing dependencies. pkg :: Install a dependency package {readline,iconv,zlib,openssl} https://rvm.io/packages/ notes :: Display notes, with operating system specifics. export :: Temporarily set an environment variable in the current shell. unexport :: Undo changes made to the environment by 'rvm export'. requirements :: Installs additional OS specific dependencies/requirements for building various rubies. Usually run by install. mount :: Install rubies from external locations. user :: Tools for managing RVM mixed mode in multiuser installations. group :: Tools for managing groups in multiuser installations. == Implementation *ruby* :: MRI/YARV Ruby (The Gold Standard) {1.8.x, 1.9.x, 2.0.x, 2.1.x, 2.2.x} jruby :: JRuby, Ruby interpreter on the Java Virtual Machine. rbx :: Rubinius ree :: Ruby Enterprise Edition, MRI Ruby with several custom patches for performance, stability, and memory. macruby :: MacRuby, insanely fast, can make real apps (Mac OS X Only). maglev :: GemStone Ruby, awesome persistent ruby object store. ironruby :: IronRuby, NOT supported yet. Looking for volunteers to help. system :: use the system ruby (eg. pre-rvm state) default :: use the default ruby (or the system ruby if a default hasn't been set). https://rvm.io/rubies/default/ == Resources: https://rvm.io/ https://www.pivotaltracker.com/projects/26822 == Contributions: Any and all contributions offered in any form, past present or future, to the RVM project are understood to be in complete agreement and acceptance with the Apache License v2.0. == LICENSE: Copyright (c) 2009-2011 Wayne E. Seguin Copyright (c) 2011-2016 Michal Papis Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Action documentation available with 'rvm help action-name': alias autolibs cleanup config-get cron current debug disk-usage do docs fetch fix-permissions gemdir gemset gemset/copy get group implode info install list migrate mount notes osx-ssl-certs patchset pkg prepare reinstall remove repair requirements reset rubygems rvmrc rvmrc/to rvmrc/warning snapshot srcdir tools uninstall upgrade use user wrapper Other topics of documentation available with 'rvm help topic': alt color upgrade-notes For additional information please visit RVM's documentation website: https://rvm.io/ If you still cannot find an answer to your question, find 'wayneeseguin', 'mpapis', 'richo', 'lemoinem' or 'rys' in #rvm on irc.freenode.net: http://webchat.freenode.net/?channels=rvm > 192:~ yuancheng$ sudo gem install cocoapods < Password: Fetching: nap-1.1.0.gem (100%) Successfully installed nap-1.1.0 Fetching: thread_safe-0.3.5.gem (100%) Successfully installed thread_safe-0.3.5 Fetching: minitest-5.8.4.gem (100%) Successfully installed minitest-5.8.4 Fetching: tzinfo-1.2.2.gem (100%) Successfully installed tzinfo-1.2.2 Fetching: i18n-0.7.0.gem (100%) Successfully installed i18n-0.7.0 Fetching: activesupport-4.2.6.gem (100%) Successfully installed activesupport-4.2.6 Fetching: escape-0.0.4.gem (100%) Successfully installed escape-0.0.4 Fetching: colored-1.2.gem (100%) Successfully installed colored-1.2 Fetching: molinillo-0.4.4.gem (100%) Successfully installed molinillo-0.4.4 Fetching: netrc-0.7.8.gem (100%) Successfully installed netrc-0.7.8 Fetching: cocoapods-trunk-0.6.4.gem (100%) Successfully installed cocoapods-trunk-0.6.4 Fetching: cocoapods-try-0.5.1.gem (100%) Successfully installed cocoapods-try-0.5.1 Fetching: cocoapods-stats-0.6.2.gem (100%) Successfully installed cocoapods-stats-0.6.2 Fetching: cocoapods-search-0.1.0.gem (100%) Successfully installed cocoapods-search-0.1.0 Fetching: cocoapods-plugins-0.4.2.gem (100%) Successfully installed cocoapods-plugins-0.4.2 Fetching: cocoapods-downloader-0.9.3.gem (100%) Successfully installed cocoapods-downloader-0.9.3 Fetching: claide-0.9.1.gem (100%) Successfully installed claide-0.9.1 Fetching: xcodeproj-0.28.2.gem (100%) Successfully installed xcodeproj-0.28.2 Fetching: fuzzy_match-2.0.4.gem (100%) Successfully installed fuzzy_match-2.0.4 Fetching: cocoapods-core-0.39.0.gem (100%) Successfully installed cocoapods-core-0.39.0 Fetching: cocoapods-0.39.0.gem (100%) Successfully installed cocoapods-0.39.0 Parsing documentation for nap-1.1.0 Installing ri documentation for nap-1.1.0 Parsing documentation for thread_safe-0.3.5 Installing ri documentation for thread_safe-0.3.5 Parsing documentation for minitest-5.8.4 Installing ri documentation for minitest-5.8.4 Parsing documentation for tzinfo-1.2.2 Installing ri documentation for tzinfo-1.2.2 Parsing documentation for i18n-0.7.0 Installing ri documentation for i18n-0.7.0 Parsing documentation for activesupport-4.2.6 unable to convert "x84" from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping Installing ri documentation for activesupport-4.2.6 Parsing documentation for escape-0.0.4 Installing ri documentation for escape-0.0.4 Parsing documentation for colored-1.2 Installing ri documentation for colored-1.2 Parsing documentation for molinillo-0.4.4 Installing ri documentation for molinillo-0.4.4 Parsing documentation for netrc-0.7.8 Installing ri documentation for netrc-0.7.8 Parsing documentation for cocoapods-trunk-0.6.4 Installing ri documentation for cocoapods-trunk-0.6.4 Parsing documentation for cocoapods-try-0.5.1 Installing ri documentation for cocoapods-try-0.5.1 Parsing documentation for cocoapods-stats-0.6.2 Installing ri documentation for cocoapods-stats-0.6.2 Parsing documentation for cocoapods-search-0.1.0 Installing ri documentation for cocoapods-search-0.1.0 Parsing documentation for cocoapods-plugins-0.4.2 Installing ri documentation for cocoapods-plugins-0.4.2 Parsing documentation for cocoapods-downloader-0.9.3 Installing ri documentation for cocoapods-downloader-0.9.3 Parsing documentation for claide-0.9.1 Installing ri documentation for claide-0.9.1 Parsing documentation for xcodeproj-0.28.2 Installing ri documentation for xcodeproj-0.28.2 Parsing documentation for fuzzy_match-2.0.4 Installing ri documentation for fuzzy_match-2.0.4 Parsing documentation for cocoapods-core-0.39.0 Installing ri documentation for cocoapods-core-0.39.0 Parsing documentation for cocoapods-0.39.0 Installing ri documentation for cocoapods-0.39.0 21 gems installed > 192:~ yuancheng$ pod search AFNEtworking -> AFNetworking (3.0.4) A delightful iOS and OS X networking framework. pod 'AFNetworking', '~> 3.0.4' - Homepage: https://github.com/AFNetworking/AFNetworking - Source: https://github.com/AFNetworking/AFNetworking.git - Versions: 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 3.0.0-beta.3, 3.0.0-beta.2, 3.0.0-beta.1, 2.6.3, 2.6.2, 2.6.1, 2.6.0, 2.5.4, 2.5.3, 2.5.2, 2.5.1, 2.5.0, 2.4.1, 2.4.0, 2.3.1, 2.3.0, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 2.0.0-RC3, 2.0.0-RC2, 2.0.0-RC1, 1.3.4, 1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0, 1.0RC3, 1.0RC2, 1.0RC1, 0.10.1, 0.10.0, 0.9.2, 0.9.1, 0.9.0, 0.7.0, 0.5.1 [master repo] - Subspecs: - AFNetworking/Serialization (3.0.4) - AFNetworking/Security (3.0.4) - AFNetworking/Reachability (3.0.4) - AFNetworking/NSURLSession (3.0.4) - AFNetworking/UIKit (3.0.4) 2.RVM curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm rvm -v rvm install 2.0.0 rvm reload rvm install 2.0.0