On the M1 macOS recovery or a new machine, running the Xcode release application reported an error:"dyld: library not loaded:/usr/lib/swift/libswiftAppKit. dylib".

In the MacOS bigsur environment of M1, an application compiled using Xcode (12.5) reported an error when running on the Terminals of Recovery or other new machine, with "dyld: library not loaded:/usr/lib/swift/libswift AppKit. dylib". May I ask if there are any compilation options that need to be changed for Xcode? In the past, on Macs with Intel chips, I could have Xcode automatically add the swift dynamic library to the app by changing the compatible system version to 10.13. However, on M1, changing the compatible minimum system version of Xcode no longer automatically adds the swift dynamic library to the frameworks. I attempted to manually add the Swift dynamic library to the application, but found that starting from OS11, the Swift dynamic library no longer exists in the/usr/lib/swift directory, and all the built-in dynamic libraries in the system are bound together and placed in Dyld_ Shared_ Cache_ In arm64e, and I am unable to extract the correct and available dylib from this file. May I ask what I need to do to successfully run the Xcode generated application in the recovery ? Or how to manually add libswiftxxx.dylib to the application.

Replies

The minimum deployment target for Apple silicon code is macOS 11. The Swift runtime is embedded in the OS starting with macOS 10.14.4. Thus there’s never any reason for an Apple silicon app to embed the Swift runtime…

… except…

May I ask what I need to do to successfully run the Xcode generated application in the recovery?

You’re talking about:

  1. Booting your Apple silicon Mac into macOS recovery.

  2. Running Terminal in that environment.

  3. Then running a third-party app from Terminal.

Right?

If so, what’s your use case? What does your app actually do such that you expect users to run it from macOS Recovery?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • Yes, I used to have a third-party visualization tool for analyzing system information and files in macOS Recovery, and now I want to update it to M1. I would like to know if there is still a way to launch my swift app in macOS Recovery?

Add a Comment

I used to have a third-party visualization tool for analyzing system information and files in macOS Recovery, and now I want to update it to M1. I would like to know if there is still a way to launch my swift app in macOS Recovery?

I used to have a third-party visualization tool for analyzing system information and files in macOS Recovery

Ah, interesting.

Yes

You mentioned testing this on macOS 11. Do you still see the problem with the macOS 13 version of macOS Recovery?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I will try upgrading the system version, but I still hope it is compatible with macOS11, so how can I solve this problem in macOS 11.

how can I solve this problem in macOS 11.

I don’t know )-:

My previous suggestion was primarily for diagnostic purposes. If upgrading to macOS 13 resolves the issue then that’s good evidence to support my theory. However, even if we confirm that theory it’s not obvious how to get around this problem.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"