Detect .bashrc sourcing issues on macOS/BSD/Solaris in doctor #2342
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Complete implementation of automatic .bashrc sourcing detection and setup for macOS, BSD, Solaris, and Illumos systems.
This PR has two parts:
Problem
On macOS/BSD/Solaris, login shells source
.bash_profileor.profile, NOT.bashrc. This causes bash-it to fail loading in:Users would install bash-it successfully but wonder why it doesn't work in their terminal.
Solution
Part 1: Detection in
bash-it doctor✅New "Profile Configuration" section that intelligently detects if .bashrc is being sourced:
Detection Strategy (Two-Phase):
Grep Detection (Primary - 99% of cases)
source ~/.bashrc,. $HOME/.bashrc, BASH_VERSION checksBrute Force Test (Fallback - Edge cases)
.bashrcaside usingmv(handles symlinks correctly).bashrcwith echo markerbash -l.bashrcExample Output:
✅ Working:
✗ Problem detected:
Part 2: Auto-Fix in
install.sh✅During installation, automatically detect and fix .bashrc sourcing:
Platform Detection:
Smart Detection:
_bash-it-doctor-check-profile-sourcing-grep()from doctorInteractive Prompt:
Safe Modifications:
command cpto bypass user aliasesUser Experience:
Before (macOS user):
After (macOS user):
Code Quality
Defensive Programming:
commandto bypass user aliases:command mv(preventsalias mv='mv -i'prompts)command grep(preventsalias grep='grep --color'breakage)command cp(preventsalias cp='cp -i'prompts)Documentation:
commandprefix pattern for future contributorsTesting
Closes
Closes #1455 (Solaris/Illumos support)
Related
Built on top of merged PR #2341 (enhanced doctor command)
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]