Skip to content

Add .profile support on Linux for login shells and non-interactive environments#424

Merged
shannah merged 1 commit intomasterfrom
claude/fix-cli-path-setup-vQKQq
Feb 22, 2026
Merged

Add .profile support on Linux for login shells and non-interactive environments#424
shannah merged 1 commit intomasterfrom
claude/fix-cli-path-setup-vQKQq

Conversation

@shannah
Copy link
Copy Markdown
Owner

@shannah shannah commented Feb 22, 2026

Summary

This PR extends the PATH management on Linux systems to include .profile in addition to .bashrc. This ensures that the PATH is properly configured for login shells, SSH sessions, cron jobs, and other non-interactive shell environments that don't source .bashrc.

Key Changes

  • Linux .profile support: Modified UnixPathManager.addToPath() to write PATH exports to .profile on Linux systems, while continuing to avoid creating .bash_profile (which would break Ubuntu's convention where .profile sources .bashrc)
  • Preserved macOS behavior: Maintained existing macOS logic that creates .bash_profile when neither .bash_profile nor .profile exist
  • Respect opt-out mechanism: Added support for the NO_AUTO_PATH_MARKER in .profile to allow users to prevent automatic PATH modifications
  • Comprehensive test coverage: Added three new test cases:
    • testAddToPathOnLinuxCreatesProfileForNonInteractiveShells: Verifies .profile is created on Linux with proper PATH export
    • testAddToPathOnLinuxRespectsNoAutoPathInProfile: Ensures the opt-out marker is respected in .profile
    • Updated existing tests to verify .profile handling in various scenarios

Implementation Details

  • On Linux, .profile is now always updated (or created) alongside .bashrc and .zshrc
  • The original .profile content is preserved when updating
  • .bash_profile is never created on Linux to maintain compatibility with Ubuntu's shell configuration chain
  • The change ensures PATH availability across all shell invocation types: interactive, login, and non-interactive shells

https://claude.ai/code/session_01Xy8SLn7cu5xwVB4NKWBiQX

…shells

Previously, the installer only wrote PATH exports to ~/.bashrc and ~/.zshrc
on Linux. This meant the PATH was only available in interactive shells, not
in login shells, SSH sessions, cron jobs, or other non-interactive
environments. Now also writes to ~/.profile on Linux (without creating
~/.bash_profile, which would break Ubuntu's convention where ~/.profile
sources ~/.bashrc).

https://claude.ai/code/session_01Xy8SLn7cu5xwVB4NKWBiQX
@shannah shannah merged commit ef485d4 into master Feb 22, 2026
10 checks passed
@shannah shannah deleted the claude/fix-cli-path-setup-vQKQq branch February 22, 2026 17:39
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