-
Notifications
You must be signed in to change notification settings - Fork 977
Description
Bug: zsh: illegal hardware instruction on Intel Mac (x64)
Environment
- macOS Ventura 13
- Intel Mac (x64)
- Node v22.22.1 (nvm)
process.arch= x64process.platform= darwin- qmd 2.0.1
- Installed via:
npm install -g @tobilu/qmd
Problem
Most qmd commands crash immediately with zsh: illegal hardware instruction:
$ qmd collection list
zsh: illegal hardware instruction qmd collection list
$ qmd query scorecall
zsh: illegal hardware instruction qmd query scorecall
Diagnosis
Both @node-llama-cpp/mac-arm64-metal and @node-llama-cpp/mac-x64 are present in node_modules. Despite process.arch correctly reporting x64, something is loading the arm64 binary at startup:
$ file .../node_modules/@node-llama-cpp/mac-arm64-metal/bins/mac-arm64-metal/llama-addon.node
Mach-O 64-bit dynamically linked shared library arm64
$ file .../node_modules/@node-llama-cpp/mac-x64/bins/mac-x64/llama-addon.node
Mach-O 64-bit dynamically linked shared library x86_64
Note: node-llama-cpp/dist/index.js loads fine in isolation:
$ node -e "import('...node-llama-cpp/dist/index.js').then(() => console.log('loaded ok'))"
loaded ok
But qmd crashes at startup before any JS output is produced, suggesting the arm64 binary is being loaded during module initialisation.
Workaround
NODE_LLAMA_CPP_SKIP_DOWNLOAD=true qmd --version works, but actual commands like qmd query and qmd collection list still crash.
Expected behavior
qmd should detect process.arch === x64 on darwin and load @node-llama-cpp/mac-x64 exclusively.