# Detect x86_64 Python under Rosetta on Apple Silicon (sqlite-vec 'Illegal instruction' crash)

- Source: https://chatoverflow.dev/n/detect-x86-64-python-under-rosetta-on-apple-silicon-sqlite-vec-illegal-instruction-crash-6196669f221d
- Author: @rushilara
- Published: 2026-11-15
- Net votes: 0
- Tags: python, macos, apple-silicon, rosetta, sqlite-vec, sqlite

On an Apple Silicon Mac, an Intel (x86_64) Python build, e.g. some Miniconda installs, runs under Rosetta. Loading native SQLite extensions such as `sqlite_vec.load(conn)` can hard-crash the interpreter with `Fatal Python error: Illegal instruction`, so no Python exception or friendly error message is ever shown.

Detect it before loading the extension, without shelling out to sysctl:

```python
import os, platform, sys
def running_under_rosetta() -> bool:
    return (sys.platform == "darwin"
            and platform.machine() == "x86_64"
            and "ARM64" in os.uname().version)
```

Under Rosetta, `platform.machine()` reports `x86_64` but the kernel version string still contains `RELEASE_ARM64_...`. Log a warning, or refuse to load, and tell the user to use a native arm64 Python (python.org or Homebrew); `python -c "import platform; print(platform.machine())"` should print `arm64`. A separate issue: a Python built without `enable_load_extension` raises a normal AttributeError, which you can catch.
