brew命令總結
- 安裝
brew install git
- 卸載
brew uninstall git
- 搜索
brew search /git*/
- 幫助
brew --help
man brew
- 顯示已經安裝的包
brew list
- 更新本地所有安裝的軟件包
brew update
- 查看已安裝的哪些軟件包需要更新
brew outdated
- 更新單個軟件包
brew upgrade
- 查看軟件包信息
brew info git
- 清理所有已安裝軟件包的歷史老版本
brew cleanup
- 清理單個已安裝軟件包的歷史版本
brew cleanup git
idevice 命令總結
- 安裝ipa包
ideviceinstaller -i xxx - 覆蓋安裝ipa包
ideviceinstaller -g xxx - 打印已安裝app列表,com.xxx是bundleid
ideviceinstaller -l - 卸載ipa包
ideviceinstaller -U - 查看設備信息
ideviceinfo - 查看設備udid
idevice_id -l - 查看iOS系統版本號
ideviceinfo -k ProductVersion - 查看系統日志
idevicesyslog - 將日志導入到iphone.log文件中
idevicesyslog >> iphone.log & - tail -f和grep查看報錯log
tail -f iphone.log
tail -f iphone.log | grep '搜索內容'
獲取設備的的UDID
- idevice_id --list # 顯示當前所連接設備的 udid
- instruments -s devices # 列出所有設備,包括真機、模擬器、mac
- ideviceinfo 可以在返回的數據中找到 udid
- ideviceinstaller -i apppath 安裝apppath下的app
- ideviceinstaller -u [udid] -i [xxx.ipa] # xxx.ipa 為應用在本地的路徑
- ideviceinstaller -u [udid] -U [bundleId]卸載應用
查看設備已安裝的應用 - ideviceinstaller -u [udid] -l # 查看設備安裝的第三方應用
- ideviceinstaller -u [udid] -l -o list_user # 同上,查看設備安裝的第三方應用
- ideviceinstaller -u [udid] -l -o list_system # 查看設備安裝的系統應用
- ideviceinstaller -u [udid] -l -o list_all # 查看設備安裝的所有應用獲取設備信息
- idevicedate 獲取設備時間
- ideviceinfo -u [udid] # 獲取設備信息
- ideviceinfo -u [udid] -k DeviceName # 獲取設備名稱 同命令 idevicename
- idevicename # 同上
- ideviceinfo -u [udid] -k ProductVersion # 獲取設備版本 10.3.3
- ideviceinfo -u [udid] -k ProductType # 獲取設備類型 iPhone 8,1
- ideviceinfo -u [udid] -k ProductName # 獲取設備系統名稱
其他系統文件信息 - ideviceinfo # 獲取設備所有信息
- idevicesyslog # 獲取設備日志
- idevicesyslog -u [udid] > /Users/home/Desktop/log.log # 將日志輸出到指定路徑
- idevicecrashreport -e test # 獲取設備 crashlog,test 是文件夾需新建
- idevicediagnostics # 管理設備狀態 - 重啟、關機、睡眠等
ios-deploy 常用命令 - ios-deploy -c # 查看當前鏈接的設備
- ios-deploy --[xxx.app] # 安裝APP
- ios-deploy --id [udid] --uninstall_only --bundle_id [bundleId] # 卸載應用
- ios-deploy --id [udid] --list_bundle_id # 查看所有應用
- ios-deploy --id [udid] --exists --bundle_id # 查看應用是否安裝
列舉設備安裝的應用: - ideviceinstaller -l則可以列出手機上所有的用戶安裝的app
運行某個app - idevicedebug run 'APP_BUNDLE_ID'可以直接launch某個app,當然,這個app必須是你通過development證書build到手機上的才行。
獲取手機的設備版本: - Ideviceinfo -k ProductVersion
獲取手機的設備名: - ideviceinfo -k ProductType
截圖: - idevicescreenshot
- idevicescreenshot /Users/medivh/Desktop/a.png # 將文件輸入到指定路徑
錄像: - xrecord --quicktime --list
- xrecord --quicktime --name="iPhone" --out="/Users/blah/video/iphone.mp4" --force
手機關機:idevicediagnostics shutdown # shutdown device
重啟手機:idevicediagnostics restart # restart device
休眠(熄屏滅屏): idevicediagnostics sleep # 類似於斷開adb . (disconnects from host)
xcrun常用命令
- bundleID
unzip xxx.ipa
cd Payload/xxx.app
defaults read `pwd`/Info CFBundleIdentifier
- show SDK
xcodebuild -showsdks # 查看本機sdk版本
- 開啟指定模擬器
xcrun instruments -w 'iPhone 7 Plus (11.4) [$uuid]'
- 安裝指定app
xcrun simctl install booted <app path>
- 運行指定app (com.example.app)
xcrun simctl launch booted <bundleID>
- 卸載指定應用
xcrun simctl uninstall booted <bundleID>
- inspector
app-inspector -u uuid/udid
windows使用tidevice
參考:https://github.com/alibaba/taobao-iphone-device
main_test、wda_tidevice是配合tidevice啟動wda的使用
安裝
pip3 install -U tidevice
啟動wda
tidevice xctest -B .xctrunner
wda崩潰自動重啟指令
tidevice wdaproxy -B com.xia.WebDriverAgentRunner.xctrunner
常用命令
- 安裝應用
$ tidevice install example.ipa - 指定設備安裝
$ tidevice --udid $UDID install https://example.org/example.ipa - 卸載應用
$ tidevice uninstall com.example.demo - 啟動應用
$ tidevice launch com.example.demo - 停止應用
$ tidevice kill com.example.demo - 查看已安裝應用
$ tidevice applist - 查看運行中的應用
- tidevice ps
$ tidevice ps --json output as json