在 Mavericks 下运行 Yosemite-only 的应用程序

2015-04-27 09:38:04 +08:00
 vista980622

从 Xcode 6.3 开始,Xcode 不再支持 Mavericks。强制修改版本号加载 app binary 无效,因为新版 Xcode 调用大量 10.10-only 的 API。

前段时间在 Github 上看到了 https://github.com/landonf/XcodePostFacto/,看到作者那句 "while the the Yosemite upgrade is free, it has its own inherent costs -- especially in terms of privacy and quality issues. Plus, I don't like being told what to do :-)" 有点小感动。问了作者能不能把类似的方式用在其他 10.10-only 的 app 上。作者说可能实现,但需要不少时间和精力来开发维护。

留在 10.9 的 V 友们有没有感兴趣的?可以去 Github 上看看实现方式。要是能有更通用的实现方法,就不用接受 Apple 的强制升级了。Office 2016、iWork'14、Davinqi Resolve 12、FCPX 10.2 之类的 app 也就都能用了啊!

附上作者实现方法的说明和概括:
"There are a number of hurdles to getting Xcode 6.3 running on an earlier release:

Xcode declares a minimum system version of 10.10, preventing launch via LaunchServices and triggering an abort() in HIServices if you bypass the initial LaunchServices check.

Xcode continues to ship with no-longer functional 10.9 compatibity code, and enables that code if it detects it's running on Mavericks. This results in crashes -- and even if you got past those, the result wouldn't actually be Xcode 6.3.

Xcode links against 10.10-only APIs, which trigger both link-time and runtime crashes.
To resolve these issues, we must patch Xcode and system libraries: disabling the legacy compatibility code, all version checks, and performing runtime rebinding of missing symbols.

XcodePostFacto leverages the following mechanisms to achieve this:

Prior to Xcode's main(), the private dyld_register_image_state_change_handler API is used to hook dyld and modify library symbol references that are critical to bootstrapping the process:

After the library has been rebased, but before it has been linked, we use a custom single-stepping implementation of dyld symbol rebinding to find strong references to Yosemite-only symbols and rewrite them as weak references.

Once the library has been linked, but before it has been initialized, we use the same BINDOPCODE* evaluator to rebind symbols to our custom replacements.

Before handing control back to Xcode, the bootstrap code uses my PLPatchMaster library to register a future patch on Xcode's DVTPlugInManager class. This patch adds xpf_bootstrap.framework/Contents/Resources/Xcode to DVTPlugInManager's plugin search path.

A custom plugin in xpf_bootstrap.framework/Contents/Resources/Xcode uses Xcode's standard plugin mechanisms to hook the IDEInitialize step, performing a final set of bootstrap operations within the now-initialized Xcode process."

2808 次点击
所在节点    macOS
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/186579

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX