From 8295a86c5dd6d5bb47c69ba20b30b6b04b64e27a Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Tue, 21 Jul 2026 18:34:33 +0000 Subject: [PATCH 67/71] fix(macos): spawn the local shell as a login shell (-l) makeLocalPty() execs the shell with no arguments, so bash/zsh run as a non-login shell and only read ~/.bashrc / ~/.zshrc -- never ~/.profile or ~/.bash_profile, which is where MacPorts' own installer appends its PATH entries (and where many users put PATH/env setup generally). Apple's Terminal.app spawns a login shell by default, so the same shell behaves differently there vs. here even though nothing else about the environment differs -- symptom: MacPorts binaries missing from PATH in Contour despite `echo $PATH` in Terminal.app showing them. Fix: pass -l as the shell's sole argument, matching Terminal.app's default and sidestepping the alternative of requiring every user to duplicate their PATH setup into shell-specific interactive-only rc files. -l is understood by bash, zsh, and ksh (the common cases); an exotic custom `shell` override that does not recognize it is on its own. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01LzTmVgP2ruMz987VJ78k77 --- src/contour_macos/TerminalSession.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/contour_macos/TerminalSession.cpp b/src/contour_macos/TerminalSession.cpp index 7533c393..3042ba2d 100644 --- a/src/contour_macos/TerminalSession.cpp +++ b/src/contour_macos/TerminalSession.cpp @@ -55,6 +55,13 @@ namespace auto const shell = !shellOverride.empty() ? shellOverride : vtpty::Process::loginShell(false).front(); auto exe = vtpty::Process::ExecInfo {}; exe.program = shell; + // Spawn as a LOGIN shell (matches Apple Terminal.app's default): without -l, bash/zsh only + // read ~/.bashrc / ~/.zshrc, never ~/.profile or ~/.bash_profile — where MacPorts' own + // installer appends its PATH entries. Without this, MacPorts binaries are invisible here even + // though they work in Terminal.app with the identical shell. -l is understood by bash, zsh, + // and ksh; an exotic custom `shell` override that does not recognize it would need to ignore + // or reject the flag on its own. + exe.arguments = { "-l" }; exe.workingDirectory = vtpty::Process::homeDirectory(); exe.env = vtpty::Process::Environment { { "TERM", "xterm-256color" } }; return std::make_unique(exe, vtpty::createPty(pageSize, std::nullopt), false);