lichao 发表于 2024-5-12 17:38:25

在MacOS高版本上使用IDA7.0



## 背景

  由于MacOS高版本默认搭载Python3.x,而IDA7.0默认使用Python2.7,因此IDA7.0启动时因无法找到Python环境,无法使用Python脚本功能。

```txt
dlopen(/Applications/IDAPro/ida64.app/Contents/MacOS/plugins/python64.dylib): dlopen(/Applications/IDAPro/ida64.app/Contents/MacOS/plugins/python64.dylib, 0x0002): Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python
Referenced from: <9ABFA618-49D6-38D0-8B94-CB4E602700E8> /Applications/IDAPro/ida.app/Contents/MacOS/plugins/python64.dylib
Reason: tried: '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file, not in dyld cache), '/Library/Frameworks/Python.framework/Versions/2.7/Python' (no such file)
/Applications/IDAPro/ida64.app/Contents/MacOS/plugins/python64.dylib: can't load file
```

&emsp;&emsp;为什么使用IDA7.0?因为Mac版本最高只有该版本破解版是原生支持的,更高的版本需要在Win模拟环境中运行(如Wineskin)。笔者同时有IDA7.0及Wine版的IDA7.7,很多脚本是在7.0上开发的,不兼容于7.7。      
&emsp;&emsp;为了解决该问题,笔者专门研究了一下,经测试无法使用Conda环境的Python2.7,非标准Python会导致IDA启动弹窗"Importing site failed"。最终笔者探索出如下方式:

1. 从Python官网安装Python2.7(https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg).   
2. 替换python64.dylib中的依赖库.   
```bash
install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python /Library/Frameworks/Python.framework/Versions/2.7/Python python64.dylib
```

最终,IDA7.0成功启动

页: [1]
查看完整版本: 在MacOS高版本上使用IDA7.0