MacBook Pro(M1,2020) macOS BigSur环境下Xcode运行Python3项目报错:Too many levels of symbolic links及Operation not permitted问题求助
Hey there, let's tackle your problem from two angles: resolving the Xcode runtime errors first, then breaking down those architecture options you're seeing.
Part 1: Fixing the "Too many levels of symbolic links" & "Operation not permitted" Errors
First, let's unpack what's causing these issues:
- The symbolic link error comes from Xcode's bundled
python3at/Applications/Xcode.app/Contents/Developer/usr/bin/python3being a broken chain of links on M1 systems—this path doesn't point to a valid, executable Python binary. - The "Operation not permitted" error is almost certainly a macOS privacy restriction blocking Xcode from accessing your project files.
Here are actionable steps to fix this:
Swap to your working Terminal Python executable
- Open Terminal and run
which python3to get the path of the Python that works for you (e.g.,/usr/bin/python3or/opt/homebrew/bin/python3if you installed via Homebrew). - In Xcode:
- Click the scheme dropdown next to the run button → Select "Edit Scheme..."
- Go to the "Run" tab → Find the "Executable" section
- Replace the default Xcode
python3path with the one you got from Terminal.
- Alternatively, in your project's Info tab, update the "Executable" dropdown to point to your working Python binary.
- Open Terminal and run
Grant Xcode file access permissions
- Open System Preferences → Security & Privacy → Privacy tab
- Select "Files and Folders" from the left sidebar
- Find Xcode in the list, and check the box next to your project's folder (or "Documents"/"Desktop" if your project lives there). This removes the permission block stopping Xcode from reading your
PythonTest.pyfile.
Quick sanity check: Create a fresh Python project
- Sometimes existing project configurations get corrupted. Try making a new "Command Line Tool" project in Xcode, set the language to Python, add a simple
print("Hello World")line, and run it. This uses Xcode's default setup and can help rule out broken config in your original project.
- Sometimes existing project configurations get corrupted. Try making a new "Command Line Tool" project in Xcode, set the language to Python, add a simple
Part 2: What Do the Architecture Options Mean for Python Execution?
Those three options control how Xcode runs code on your M1 chip, and here's how they impact Python:
- Apple Silicon (identical to Apple Silicon (arm64)): Runs code natively on the M1's arm64 architecture. This is the fastest option, as it uses the M1's native instruction set without any translation. If your Python interpreter is compiled for arm64 (like the system Python on M1 Macs, or Homebrew's arm64 Python), this lets it run at full speed.
- Apple Rosetta: Uses Rosetta 2, Apple's translation layer, to run x86_64 (Intel-compatible) code on the M1. You'd use this if your Python interpreter or any dependencies are only compiled for Intel chips. Rosetta adds a small performance overhead but lets you run legacy x86_64 software seamlessly.
The reason your error happens no matter which option you choose is that the root issue is the broken symbolic link and file permissions—not the architecture itself. Fixing the Python executable path and permissions should make all options work (depending on your interpreter's compiled architecture).
内容的提问来源于stack exchange,提问作者S.Calbert

