Mac 安裝 home Brew以及 XCTool的過程記錄


一、HomeBrew相關:

先對HomeBrew做一個簡單的介紹吧,之前了解的也不多。

主要就是用於安裝Unix的工具包。

注意:HomeBrew依賴於Xcode的 Command Line Tool.

官方的鏈接:

http://mxcl.github.io/homebrew/

 

Homebrew作為OS X上強大的包管理器,為系統軟件提供了非常方便的安裝方式,獨特式的解決了包的依賴問題,並不再需要煩人的sudo,一鍵式編譯,無參數困擾,真的,你值得擁有。

安裝

Homebrew依賴於XCode,首先需要安裝,lion后XCode也是免費的了,直接到App store下載。同時Homebrew也依賴ruby,Mac已經自帶ruby。

1
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

使用

  • 查看brew的幫助
1
brew --help
  • 安裝軟件
1
brew install git
  • 卸載軟件
1
brew uninstall git
  • 搜索軟件
1
brew search git
  • 顯示已經安裝軟件列表
1
brew list
  • 更新軟件,把所有的Formula目錄更新,並且會對本機已經安裝並有更新的軟件用*標明。
1
brew update
  • 更新某具體軟件
1
brew upgrade git
  • 查看軟件信息
1
brew [info | home] [FORMULA...]
  • 刪除程序,和upgrade一樣,單個軟件刪除和所有程序老版刪除。
1
2
brew cleanup git brew cleanup
  • 查看那些已安裝的程序需要更新
1
brew outdated

程序安裝路徑及文件夾

Homebrew將本地的/usr/local初始化為git的工作樹,並將目錄所有者變更為當前所操作的用戶,以后的操作將不需要sudo。

1
2
3
4
5
6
-bin 用於存放所安裝程序的啟動鏈接(相當於快捷方式) -Cellar 所以brew安裝的程序,都將以[程序名/版本號]存放於本目錄下 -etc brew安裝程序的配置文件默認存放路徑 -Library Homebrew 系統自身文件夾 +–Formula 程序的下載路徑和編譯參數及安裝路徑等配置文件存放地 +–Homebrew brew程序自身命令集

 

HomeBrew與MacPorts的比較,貌似MacPorts會被人逐漸遺棄

http://hi.hiing.net/2011/06/use-homebrew-package-management.html

 

二、XCTool相關

xctool是facebook開源的一個命令行工具,用來替代蘋果的xcodebuild工具。

功能如下:

  • 像xcode一樣跑測試用例
  • 結構化輸出編譯測試結果
  • 彩色且方便閱讀的編譯內容輸出

示例截圖:

xctool

如何安裝xctool

最簡單的辦法是通過homebrew安裝xctool

brew update brew install xctool

搞定

如何使用xctool

打包

path/to/xctool.sh \ -workspace YourWorkspace.xcworkspace \ -scheme YourScheme \ archive

build

path/to/xctool.sh \ -workspace YourWorkspace.xcworkspace \ -scheme YourScheme \ build

測試

path/to/xctool.sh \ -workspace YourWorkspace.xcworkspace \ -scheme YourScheme \ test

 

使用命令如下,上面的命令參照

切換到工程目錄下,然后輸入如下命令:

 

xctool -workspace taoappios.xcworkspace -scheme taoappios archive 

 

生成archive文件

 

xctool -workspace taoappios.xcworkspace -scheme taoappios build 

編譯

 

usage: xctool [BASE OPTIONS] [ACTION [ACTION ARGUMENTS]] ...

 

Examples:

    xctool [BASE OPTIONS] clean

    xctool [BASE OPTIONS] build

    xctool [BASE OPTIONS] build-tests [-only TARGET] [-skip-deps]

    xctool [BASE OPTIONS] run-tests [-test-sdk SDK] [-only SPEC] [-freshSimulator] [-freshInstall]

    xctool [BASE OPTIONS] test [-test-sdk SDK] [-only SPEC] [-skip-deps] [-freshSimulator] [-freshInstall]

    xctool [BASE OPTIONS] archive

 

Base Options:

    -help                    show help

    -workspace PATH          path to workspace

    -project PATH            path to project

    -scheme NAME             scheme to use for building or testing

    -find-target TARGET      Search for the workspace/project/scheme to build the target

    -find-target-path PATH   Path to search for -find-target.

    -find-target-exclude-pathColon-separated list of paths to exclude for -find-target.

    -sdk VERSION             sdk to use for building (e.g. 6.0, 6.1)

    -configuration NAME      configuration to use (e.g. Debug, Release)

    -jobs NUMBER             number of concurrent build operations to run

    -arch ARCH               arch to build for (e.g. i386, armv7)

    -toolchain PATH          path to toolchain

    -xcconfig PATH           path to an xcconfig

    -reporter TYPE[:FILE]    add reporter

    -showBuildSettings       display a list of build settings and values

    -version                 print version and exit

    SETTING=VALUE            Set the build 'setting' to 'value'

 

Options for 'build-tests' action:

    -only TARGET             build only a specific test TARGET

    -skip-deps               Only build the target, not its dependencies

 

Options for 'run-tests' action:

    -test-sdk SDK            SDK to test with

    -only SPEC               SPEC is TARGET[:Class/case[,Class2/case2]]

    -freshSimulator          Start fresh simulator for each application test target

    -freshInstall            Use clean install of TEST_HOST for every app test run

 

Options for 'test' action:

    -test-sdk SDK            SDK to test with

    -only SPEC               SPEC is TARGET[:Class/case[,Class2/case2]]

    -skip-deps               Only build the target, not its dependencies

    -freshSimulator          Start fresh simulator for each application test target

    -freshInstall            Use clean install of TEST_HOST for every app test run

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM