如何下载和安装Carthage?
使用Brew安装(建议)
1.安装Mac OSX流行的的软件包管理工具Homebrew之前要检查Mac中是否有Ruby环境,目前的版本基本都内置了Ruby,终端输入
ruby -v
2.显示类似 ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
brew -v
3.显示类似文本 Homebrew 2.1.16
Homebrew/homebrew-core (git revision 7e82; last commit 2019-11-10) 说明已经安装brew不需要再次安装;反之则需要安装Homebrew
如何下载和安装Homebrew?
如果电脑中没有Homebrew,终端执行脚本安装即可
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
执行后 报错:
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
从报错来看,是说 /Library/Developer/CommandLineTools 不是 xcode-select 的有效路径,这个时候只需要使用下面这个命令设置一下就可以了:
sudo xcode-select --switch /Applications/Xcode.app
输入下面命令验证一下:
xcode-select -p
打印输出 :/Applications/Xcode.app/Contents/Developer,到此则继续安装Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
看到控制台输出:
Already up-to-date.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/Analytics.html
Homebrew安装成功啦!
如何使用Homebrew安装Carthage?
很简单,使用下面命令既可:
brew install carthage
然后看到命令台输出
==> Downloading https://homebrew.bintray.com/bottles/carthage-0.34.0.catalina.bo
==> Downloading from https://akamai.bintray.com/e3/e3498577798d41c08522e1478e125
######################################################################## 100.0%
大功告成!!













网友评论