Bizarre problem, wonder if anyone else has run into this.
I'm running macOS 12 which still has system Python 2.7. However my shell starts a conda environment by default with Python 3.9.12
A few weeks ago I installed Swift 5.10 using the package installer, to run from the command line.
In Xcode 13.4.1 I use the Toolchains dialog to select Swift 5.10 Release 2024-03-04
In the shell (zsh) I invoke
export TOOLCHAINS=swift
to select the 5.10 toolchain. Swift --version shows 5.10 as expected.
FOR WEEKS I have been running swift repl and swift test from the command line,
with no problems. I frequently run swift --version to make sure I really have 5.10. No changes to OS in those weeks.
TODAY, in swift repl , I was having trouble getting the compiler to parse an expression (it says it's too complicated!), and the compiler seemed stuck for a long time, so I killed the repl session (lldb) using the Activity Monitor.
From that point forward I cannot run swift repl or lldb from the command line. The start of the long error message :
dyld[33556]: Library not loaded: @rpath/Python3.framework/Versions/3.9/Python3
Referenced from: /Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB
Reason: tried: '/usr/lib/swift/Python3.framework/Versions/3.9/Python3' (no such file)
(then follows a cavalcade o' folders, various permutations of Toolchains names...)
My interpretation of this is that the lldb framework is trying to use python from a directory under /usr/lib/swift. /usr/lib/swift exists , but has old content, couple files I have no clue about :
lrwxr-xr-x 1 root wheel 71 Oct 17 2021 libswiftCreateML.dylib -> /System/Library/Frameworks/CreateML.framework/Versions/Current/CreateML
-rwxr-xr-x 1 root wheel 1362544 Oct 17 2021 libswiftRemoteMirror.dylib
So what gives? I deleted the toolchain directory and reinstalled Swift 5.10, no change.
My sense is that Swift no longer relies on the macOS system python (good!), but now expects a separate distribution. My system python (2.7) and conda python (3.9) should be totally irrelevant.
This makes no sense: I was running Swift 5.10 in repl mode for weeks, if it was finding python , where did the python distro go? Why did killing lldb make this go permanently awry?
Thanks in advance,
Randy
P.S. It just occurred to me that /usr/lib/ is read-only in this OS. In fact all my files in /usr/lib are dated Oct 17 2021, that must be the date I upgraded to the current macOS 12.0 . So if the swift installer expects to put anything in /usr/lib/swift, not going to happen.