Skip to content

install.sh: shell-aware PATH instructions - #2

Merged
stevevanhooser merged 5 commits into
mainfrom
claude/smrx-cli-matlab-bridge-acxw21
Jul 18, 2026
Merged

stevevanhooser merged 5 commits into
mainfrom
claude/smrx-cli-matlab-bridge-acxw21

Conversation

@stevevanhooser

Copy link
Copy Markdown
Contributor

What

When ~/.local/bin isn't already on the user's PATH, install.sh printed an instruction that hard-coded ~/.profile. zsh — the default macOS shell since Catalina (and on Tahoe) — does not read ~/.profile, so that advice silently did nothing for most Mac users.

This makes the PATH hint shell-aware, based on the login shell ($SHELL):

Shell Instruction printed
zsh append export PATH=... to ~/.zshrc (+ source)
bash ~/.bash_profile on macOS, ~/.bashrc on Linux
fish fish_add_path <dir>
other generic export PATH=... fallback

Why

The installer creates an isolated venv and symlinks the sonpipe command into ~/.local/bin; if that directory isn't on PATH, the printed fix needs to target a file the user's shell actually sources — otherwise the command appears "not found" even after a successful install.

Testing

  • bash -n install.sh (syntax) passes.
  • Ran the installer end-to-end with SHELL=/bin/zsh and a --bin-dir not on PATH; confirmed it now prints:
    echo 'export PATH="…/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc

No functional change to the install itself — only the PATH guidance text.

🤖 Generated with Claude Code


Generated by Claude Code

VH-Lab and others added 5 commits July 18, 2026 18:43
The PATH warning hard-coded ~/.profile, which zsh (the macOS default since
Catalina, including Tahoe) does not read, so the advice silently did nothing
for most Mac users. Detect the login shell and print the correct instruction:
~/.zshrc for zsh, ~/.bash_profile (macOS) / ~/.bashrc (Linux) for bash,
fish_add_path for fish, with a generic fallback otherwise.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
CED's macOS sonpy is x86_64-only and linked against the python.org framework
build, so it fails to load under uv/Homebrew Python or when run as arm64. The
installer now handles this end-to-end on Apple Silicon:

- Prefer the python.org framework Python
  (/Library/Frameworks/Python.framework/Versions/3.14/bin/python3.14) when no
  --python is given on macOS.
- Detect Apple Silicon and build + install the venv as x86_64 via `arch
  -x86_64` (Rosetta); error early with a clear pointer to python.org if the
  chosen interpreter can't run x86_64.
- Install the `sonpipe` command as an `arch -x86_64` wrapper (not a symlink) so
  it runs x86_64 even when invoked from a native-arm64 host such as MATLAB.
- Give a macOS-specific message (pointing at the python.org installer) if sonpy
  still can't be imported, and verify via load_sonpy() so the check matches how
  the tool actually resolves sonpy.

Document the python.org requirement in the README's Apple Silicon note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
Callers such as MATLAB pass paths like '~/Desktop/x.smrx' through literally,
and neither the shell (the arg is quoted) nor Python expands the tilde, so the
file was reported missing. SmrxFile now runs os.path.expanduser on the path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
Re-running install.sh now reuses an existing environment and upgrades the
sonpipe package in place (fast; no venv rebuild, no sonpy re-download) instead
of failing or rebuilding. The update path skips base-Python discovery entirely
(the venv already has its interpreter), so `./install.sh` with no args works as
the updater. Add --recreate for a clean rebuild and --update as an explicit
alias, and a thin update.sh wrapper for discoverability.

Also fix a set -u crash: PYVER was unset on the reuse path (used in the
sonpy-import-failed message); it is now derived from the venv's Python and
always defined.

Document updating in the README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
os.path.expanduser('~/ex.smrx') returns a path with a forward slash in the
tail on Windows, so the exact string compare against str(tmp_path/'ex.smrx')
(backslash) failed there. Compare with os.path.normpath so the assertion is
separator-agnostic. Product behaviour was already correct.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VTQEJGfiSxeVG1J5GSmaTy
@stevevanhooser
stevevanhooser merged commit 160e698 into main Jul 18, 2026
9 checks passed
@stevevanhooser
stevevanhooser deleted the claude/smrx-cli-matlab-bridge-acxw21 branch July 18, 2026 19:16
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