Skip to content

Add macOS support - #1

Merged
Jayktopus merged 3 commits into
Jayktopus:mainfrom
etjones:feature/macos-compatibility
Aug 3, 2026
Merged

Add macOS support#1
Jayktopus merged 3 commits into
Jayktopus:mainfrom
etjones:feature/macos-compatibility

Conversation

@etjones

@etjones etjones commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds macOS as a supported platform. The workbench code was already portable; this PR contributes a cross-platform per-user installer, platform-aware filesystem paths, docs, and a macOS CI leg.

  • New scan2sketch/platform_paths.py — resolves the venv interpreter layout (bin/python vs Scripts\python.exe), the per-user cache root (~/Library/Caches / %LOCALAPPDATA% / XDG), and the FreeCAD user-data base. All previously Windows-hardcoded path sites in external_backend, calibration_runtime, diagnostics, calibration_profile, and the calibration dialogs now go through it. Windows behavior is unchanged.
  • New scripts/install_user_addon.py / uninstall_user_addon.py — stdlib-only ports of the PowerShell installers for macOS/Linux: same copy/dev-link modes, safety stops, SHA-256-verified model downloads, and isolated venvs built from FreeCAD's bundled Python. The installer asks freecadcmd for App.getUserAppDataDir() so it keeps targeting the right versioned directory (v1-1, v1-2, ...) across FreeCAD upgrades, and finds the bundle Python inside /Applications/FreeCAD*.app automatically. On Windows these scripts defer to the existing .ps1 files.
  • Declared the missing shapely test dependency in requirements-opencv-spike.txt. scan2sketch/core/offset.py relies on the Shapely that FreeCAD ships at runtime, but the FreeCAD-independent test environment never declared it, so test_offset.py's robust-offset test fails in a fresh CI-style environment on every platform (same situation SciPy was in before 7367ce1). Pinned to 2.1.2 to match FreeCAD 1.1.1's bundled version.
  • CIcore-tests.yml now runs a windows-latest + macos-latest matrix.
  • Docs — new INSTALL_MACOS.md (linked from README/INSTALL.md), including honest platform floors: macOS 13+ on Apple silicon, macOS 14+ on Intel (the opencv wheel floor), and OpenCV-mode-only on Intel Macs since PyTorch publishes no Intel macOS wheels for the pinned torch — the installer fails fast with that explanation.

Testing

  • Full 198-test suite passes on macOS (Apple silicon) in a venv built by the new installer from FreeCAD 1.1.3's bundled Python 3.11, and on both CI legs.
  • End-to-end in FreeCAD 1.1.3 on macOS: install (dev-link and copy modes), workbench registration, first-run wizard, grid calibration of a synthetic 600 dpi scan (quality "high", 0.017 mm residual, profile saved to App.getUserAppDataDir()), scan analysis through the isolated OpenCV helper, and sketch creation (5 geometries, ±0.082 mm reported uncertainty). Diagnostic export and uninstall verified.
  • Not yet tested on macOS: --full-vision (SAM) runtime and real-scanner input.

Notes for maintainers

  • Heads-up beyond this PR: torch==2.5.1 has no cp313 wheels on any platform, so if a future FreeCAD bundles Python 3.13 the full-vision install breaks on Windows too; the pin will need a bump at that point.
  • A German translation of INSTALL_MACOS.md is not included; happy to follow up if wanted.

🤖 Generated with Claude Code

etjones and others added 3 commits August 3, 2026 12:04
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@etjones

etjones commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

(BTW, I pointed Claude at this repo when I saw there was a need for macOS as well, and it set up the PR above. But I'm a real guy, looking to support this as needed. Thanks for putting together the workbench!)

@Jayktopus
Jayktopus merged commit 1448541 into Jayktopus:main Aug 3, 2026
2 checks passed
@Jayktopus

Copy link
Copy Markdown
Owner

Thank you — the macOS support has been merged after all 198 tests passed on both Windows and macOS. I added a visible follow-up note to the English and German documentation clarifying that the OpenCV workflow has been tested on Apple silicon, while the optional SAM / Light HQ-SAM full-vision path remains experimental on macOS until it receives equivalent end-to-end testing.

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.

2 participants