Skip to content

fix(install): prioritize .bash_profile over .bashrc on macOS#17152

Closed
nil957 wants to merge 1 commit intoanomalyco:devfrom
nil957:fix/bash-profile-priority-macos
Closed

fix(install): prioritize .bash_profile over .bashrc on macOS#17152
nil957 wants to merge 1 commit intoanomalyco:devfrom
nil957:fix/bash-profile-priority-macos

Conversation

@nil957
Copy link

@nil957 nil957 commented Mar 12, 2026

Summary

On macOS, Terminal.app and iTerm open login shells by default, which source ~/.bash_profile but not ~/.bashrc. The installer was checking ~/.bashrc first, causing the PATH export to be written to a file that's never sourced in new terminal sessions.

Changes

  • Reorder the config file candidates for bash on macOS to check ~/.bash_profile first
  • Linux behavior is unchanged since non-login interactive shells source ~/.bashrc

Testing

Tested on macOS with bash:

  1. ~/.bashrc exists
  2. Run installer
  3. Verify PATH is written to ~/.bash_profile
  4. Open new terminal → opencode is found

Fixes #17132

On macOS, Terminal.app and iTerm open login shells by default, which source
~/.bash_profile but not ~/.bashrc. The installer was checking ~/.bashrc first,
causing the PATH export to be written to a file that's never sourced in new
terminal sessions.

This commit reorders the config file candidates for bash on macOS to check
~/.bash_profile first, ensuring the opencode PATH is correctly set for login
shells.

Linux behavior is unchanged since non-login interactive shells (the default
for most terminal emulators) source ~/.bashrc.

Fixes anomalyco#17132
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 12, 2026
@github-actions
Copy link
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found

PR #17131: "fix: prioritize .bash_profile over .bashrc for bash on macOS"

This appears to be the same fix addressing the identical issue - prioritizing .bash_profile over .bashrc on macOS for the installer. Both PRs are targeting issue #17132 and have nearly identical titles/purposes.

@nil957
Copy link
Author

nil957 commented Mar 12, 2026

Closing as duplicate of #17131 which addresses the same issue.

@nil957 nil957 closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: bash installer writes PATH to ~/.bashrc instead of ~/.bash_profile on macOS

1 participant