Xcode brew安装和使用

本文介绍了如何在Mac上通过Homebrew安装Carthage,并详细阐述了从创建Cartfile到更新第三方库的完整流程,帮助开发者在Xcode项目中便捷地管理和集成第三方框架。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

打开终端,输入命令:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

根据提示完成安装(有可能安装失败,将路径修改为 /usr/local/bin , 没有失败按照正常流程)

安装结束后输入 brew, 会出现相应的提示命令:

Example usage:

  brew [info | home | options ] [FORMULA...]

  brew install FORMULA...

  brew uninstall FORMULA...

  brew search [foo]

  brew list [FORMULA...]

  brew update

  brew upgrade [FORMULA...]

  brew pin/unpin [FORMULA...]


Troubleshooting:

  brew doctor

  brew install -vd FORMULA

  brew [--env | config]


Brewing:

  brew create [URL [--no-fetch]]

  brew edit [FORMULA...]

  https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md


Further help:

  man brew

  brew home


如此表示 brew 安装成功,下一步安装   carthage ,终端输入命令:

brew install carthage

出现:

==> Downloading https://homebrew.bintray.com/bottles/carthage-0.15.2.el_capitan.

######################################################################## 100.0%

==> Pouring carthage-0.15.2.el_capitan.bottle.tar.gz

��  /usr/local/Cellar/carthage/0.15.2: 37 files, 11.9M


安装成功,继续输入命令 carthage 出现

Available commands:


   archive           Archives built frameworks into a zip that Carthage can use

   bootstrap         Check out and build the project's dependencies

   build             Build the project's dependencies

   checkout          Check out the project's dependencies

   copy-frameworks   In a Run Script build phase, copies each framework specified by a SCRIPT_INPUT_FILE environment variable into the built app bundle

   fetch             Clones or fetches a Git repository ahead of time

   help              Display general or command-specific help

   update            Update and rebuild the project's dependencies

   version           Display the current version of Carthage

表示安装成功.

在mac 某个目录下新建一个文件夹取名 Carthage,终端进入该文件夹

cd /Users/XXXX/Carthage

终端输入命令

vim Cartfile 

能生成一个Cartfile的文件,输入 i 进行编辑,输入所需要的第三方库例如: github "Alamofire/Alamofire" ~> 3.0 按 esc 退出,输入冒号":",继续输入 wq 结束

终端输入 


carthage update

出现


*** Cloning Alamofire

*** Checking outAlamofire at "3.3.0"

*** xcodebuild output can be found in/var/folders/bt/s3tsn68n7mg3x04fnhkxq7wm0000gn/T/carthage-xcodebuild.7U0poN.log

*** Building scheme"Alamofire OSX" in Alamofire.xcworkspace

*** Building scheme"Alamofire tvOS" in Alamofire.xcworkspace

*** Building scheme"Alamofire watchOS" in Alamofire.xcworkspace

*** Building scheme"Alamofire iOS" in Alamofire.xcworkspace

表示引用的第三方库成功

将生成的 framework 引入所需要的工程中




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值