libimobiledevice命令

时间:2023-12-06 16:10:56

Mac 安装
1. 安装HomeBrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

参考:http://brew.sh/

2. 终端执行如下命令
2.1 brew install libimobiledevice
2.2 brew install Caskroom/cask/osxfuse
2.3 brew install ifuse
2.4 brew install ideviceinstaller

openSUSE13.2 安装
http://download.opensuse.org/repositories/home:/FunkyM:/iOS/openSUSE_13.1/ios-device-support.ymp
http://download.opensuse.org/repositories/home:/FunkyM:/iOS/openSUSE_13.2/ios-device-support.ymp

openSUSE命令执行有问题的话,先重启系统,执行
idevicepair unpair
idevicepair pair

1.打印app列表
ideviceinstaller -l

2.选择要导出的appid,如com.youku.YouKu

3. 打包并导出app到指定文件夹
ideviceinstaller -a com.tencent.xin -o copy=~
导出成功会看到
Archive - Complete
Copying 'ApplicationArchives/com.youku.YouKu.zip' --> '/Users/Travel/Desktop/idevice/com.youku.YouKu.ipa'... DONE.

4.删除设备上的APP
ideviceinstaller -U com.youku.YouKu

5.安装App
ideviceinstaller -i /home/aaron/com.youku.YouKu.ipa

6. 访问沙盒 ifuse -u f93f5ade2ab2838d051e9e3479bd4ef5666c3a78 --container com.travel.chu.icsdk ~/Desktop/sandbox

1. 功能例子
1.1 获取 UDID
idevice_id -l
1.2 截屏并保存到当前目录
ideviceimagemounter ./DeveloperDiskImage.dmg ./DeveloperDiskImage.dmg.signature // 打开文件访问
idevicescreenshot -u f93f5ade2ab2838d051e9e3479bd4ef5666c3a78
1.3 重启设备
idevicediagnostics restart
1.4 安装APP
ideviceinstaller -i /Users/aaron/书香苏州_20150104.ipa
1.5 卸载APP
ideviceinstaller -U ideviceinstaller -U com.szsmk.bookofsuzhou
此处注意在Ubuntu上基于libimobiledevice4,需使用(小写u)ideviceinstaller -u com.test.app
1.6 获取APP列表及APP信息
ideviceinstaller -l
1.7 获取设备信息
ideviceinfo

31824949d15de007d24633be0e33a61228a764c0 iPhone 6
9e58d623c1ecda61a1bf8b239924cb004fa825da iPhone 4s
f93f5ade2ab2838d051e9e3479bd4ef5666c3a78 iPad 2

获取日志
idevicesyslog > log.txt &

遇到的坑:使用命令时提示:

ideviceinstaller fails with “Could not connect to lockdownd. Exiting.”

解决方法:卸载重装

brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install ideviceinstaller
brew link --overwrite ideviceinstaller