反馈请联系hertz@hertzwang.com,谢谢
Ruby相关
- 下载安装Ruby https://www.ruby-lang.org/en/
- 升级Ruby环境
$ sudo gem update
- 查看Ruby镜像
$ gem sources -l
- 移除Ruby镜像
$ gem sources --remove 镜像地址
- 添加Ruby镜像
$ gem sources --add 镜像地址
- 查看Ruby安装的包
$ gem list
或$ /usr/bin/gem list
- 移除Ruby安装的包
$ sudo gem uninstall PACKAGENAME -v xx.xx.xx
注:
- RubyGems 镜像参考https://gems.ruby-china.com
- Ruby环境分
system
和local
,路径分别是/usr/bin/gem
和/usr/local/bin/gem
- 系统自带没有权限时需要下载Ruby,
brew install ruby
CocoaPods相关
安装CocoaPods
$ sudo gem install cocoapods
卸载CocoaPods
$ sudo gem uninstall cocoapods
查询三方版本信息
$ pod search 项目名
根据Podfile集成
$ pod install
Podfile 模板
1
2
3
4
5
6platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'AFNetworking', '~> 3.0'
end注册CocoaPods
$ pod trunk register 邮箱地址 '用户名' --verbose
,注册后需要邮件确认查看CocoaPods信息
$ pod trunk me
创建共享库
$ pod lib create 库名
更新CocoaPods库(需要等待)
$ sudo gem install cocoapods $ pod repo $ pod setup
查看本地库大小
$ cd ~/.cocoapods/ $ du -sh *
清理 Cocoapods
*
注:参考 https://guides.cocoapods.org
问题
brew install xxx 提示”ERROR: No formulae found in taps.”
解决方案【转载:Homebrew执行命令时出错的解决方案】
1.删除taps:rm -rf /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
2.更新brew:brew update
升级 Mac OS 导致 -bash: pod: command not found
1.为了安全起见,执行命令”sudo gem uninstall cocoapods”,卸载原有的CocoaPod
2.执行命令”sudo gem install -n /usr/local/bin cocoapods”来重新安装cocoapod
3.如果没有权限执行pod,执行命令”sudo chmod +rx /usr/local/bin/“,赋予/usr/local/bin给予执行与读取权限
参考链接:https://github.com/CocoaPods/CocoaPods/issues/3736
升级 MacOS High Sierra 导致 bad interpreter: No such file or directory
$ sudo gem update --system
$ sudo gem install cocoapods -n/usr/local/bin
参考链接:http://www.cocoachina.com/bbs/read.php?tid-1727144-page-e.html