Skip to content

Comments

fix: macOS arm64 compat for way-match and test scripts#38

Open
0x3dge wants to merge 2 commits intoaaronsb:mainfrom
0x3dge:fix/way-match-macos-compat
Open

fix: macOS arm64 compat for way-match and test scripts#38
0x3dge wants to merge 2 commits intoaaronsb:mainfrom
0x3dge:fix/way-match-macos-compat

Conversation

@0x3dge
Copy link

@0x3dge 0x3dge commented Feb 22, 2026

Summary

  • Rebuild bin/way-match as native arm64 Mach-O (was Linux x86-64 ELF, failing with exec format error)
  • Fix test-harness.sh and test-integration.sh for bash 3.2 (macOS default) — replace declare -A and mapfile with indexed arrays and while-read loops
  • Add /sync-upstream skill to automate pulling changes from aaronsb/claude-code-config while preserving our platform fixes

Test plan

  • way-match --version runs on arm64 macOS
  • way-match pair correctly matches and rejects (3 end-to-end tests via match-way.sh)
  • way-match suggest analyzes a real way.md file
  • Test harness runs on bash 3.2: 72/74 accuracy (97.3%), 0 false positives
  • /sync-upstream skill detected by skill system

John-Luke Peck added 2 commits February 21, 2026 16:36
The checked-in binary was a Linux x86-64 ELF which fails with
"exec format error" on arm64 macOS. Rebuilt with `make local` to
produce a native Mach-O binary.

Both test scripts used bash 4+ features (declare -A, mapfile) that
fail on macOS default bash 3.2. Replaced with parallel indexed arrays
and while-read loops.
This fork diverges from upstream (aaronsb/claude-code-config) with
platform-specific fixes (arm64 binary, bash 3.2 compat). The skill
automates fetching, diffing, and merging upstream changes while
preserving our local fixes through documented conflict resolution.
@0x3dge
Copy link
Author

0x3dge commented Feb 22, 2026

Hey! I forked this to run on macOS (arm64 Apple Silicon) and hit a couple of issues. Here's what this PR fixes and why:

1. bin/way-match binary — Linux ELF on macOS

The checked-in binary is a Linux x86-64 ELF:

$ file bin/way-match
bin/way-match: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV)...

macOS can't execute this — it needs a Mach-O binary (or a Cosmopolitan APE, which the Makefile supports but isn't what was checked in). The fix here is just make local which rebuilds with the system compiler. The Makefile already has the local target, so the tooling was there — just the checked-in binary wasn't cross-platform.

Suggestion for upstream: Either ship a Cosmopolitan APE binary (which runs on both Linux and macOS), or don't check in the binary at all and have users run make local. The cosmocc build target in the Makefile would produce a universal binary if you have the Cosmopolitan toolchain installed.

2. Test scripts use bash 4+ features

macOS ships bash 3.2 (Apple won't ship bash 4+ due to GPLv3 licensing). Both test-harness.sh and test-integration.sh use:

  • declare -A (associative arrays) — bash 4+ only
  • mapfile -t — bash 4+ only

These fail immediately on macOS:

declare: -A: invalid option

The fix replaces these with bash 3.2 compatible patterns:

  • Parallel indexed arrays + a lookup function instead of associative arrays
  • while IFS= read -r loop instead of mapfile

No behavior change — same test cases, same output format, same results. Just works on both platforms now.

Results after fixes

Everything works on macOS arm64:

  • Binary runs, all three modes (pair, score, suggest) functional
  • Test harness: 72/74 accuracy (97.3%), 0 false positives, all 10 co-activation tests pass
  • Hook integration (match-way.sh) correctly detects and uses the BM25 engine

Happy to help if you have questions about the macOS side of things!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant