安装ios开发环境

安装brew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

升级ruby版本,否则安装cocoapods会报错

brew upgrade ruby
如果提示没有安装则
brew install ruby

加入环境变量,否则ruby -v版本还是老的

 echo 'export PATH="/opt/homebrew/opt/ruby@3.2/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

 

安装cocoapods

sudo gem install -n /usr/local/bin cocoapods

sudo gem install -n /usr/local/bin cocoapods-binary

 报错,则修改权限到775

 % sudo gem install -n /usr/local/bin cocoapods

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21: warning: Insecure world writable dir /opt/homebrew/sbin in PATH, mode 040777

^CERROR:  Interrupted

 % sudo chmod 775 /opt/homebrew/sbin

增加gem源

gem sources -l

gem sources --remove https://rubygems.org/

gem source -a https://gems.ruby-china.com

gem sources -l

 到项目路径执行

pod install

报错:

Cocoapos error - [!] Couldn't determine repo type for URL: `https://cdn.cocoapods.org/`: Non-HTTP proxy URI

或

CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/4/a/9/SwiftProtobuf/1.9.0/SwiftProtobuf.podspec.json Response: Timeout was reached

解决方案:

在hosts增加配置

146.75.113.229              cdn.jsdelivr.net

 

posted @ 2023-06-16 02:06  然然1907  阅读(120)  评论(0编辑  收藏  举报