参考木桩大神: http://blog.imaou.com/opensource/2014/12/04/compile_python-imobiledevice_on_macos.html
由于存有多个版本的Python, 会出现路径问题, 所以将/System/Library/Frameworks/Python.framework 和 /Library/Python 文件夹改了名,让它只能找到我们自己安装的Python
之前是使用的MacPorts来管理的软件包,但是上面包更新速度比较慢,则改用了brew, 吐个槽,下载brew那个慢啊(不挂VPN下不动)。。
1. 安装好brew后,安装 Python, Cython
2. 安装 libplist, 从https://github.com/libimobiledevice 下载源码编译,configure 的时候会提示使用的(non-standard-path)非标准的python路径,于是在configure时指定Python路径
先获取Python路径: python-config --prefix 会得到 /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7
重新configure: ./autogen.sh LDFLAGS="-L/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib"
确保看到Python binding 是启用的
然后make & make install , 再测试 import plist 没问题, 这块折腾了好多遍,就是多个版本的Python导致,后来Email木桩大神,建议使用自定义的Python解决
再执行 brew link --overwrite libplist 将libplist 放到 /usr/local/Cellar/libplist/x.xx 在x.xx目录下mkdir cython, 将libplist源文件中的cython文件夹内的plist.p*拷贝过来,
此步骤是为安装libimobiledevice做准备,否则libimobiledevice会找不到Python Binding...... 坑
3. 安装libusbmuxd:
直接./autogen.sh, 本以为一切顺利,结果。。。 提示libplist找不到或者 plist的符号链接找不到,总之就是libplist没找着,
解决方法: export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
再 configure, make & make install 一切顺利
4. 安装libimobiledevice:
configure, make & make install 一切顺利
最后连接好终端 idevice_id -l 看结果