Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(desktop): an installed tmux is ready whatever the Xcode toolchain says

0xdiego254d4ed7158315
diff --git a/desktop/lib/bootstrap/environment_provisioner.dart b/desktop/lib/bootstrap/environment_provisioner.dart
index 9dda63396..769257b8c 100644
--- a/desktop/lib/bootstrap/environment_provisioner.dart
+++ b/desktop/lib/bootstrap/environment_provisioner.dart
@@ -496,8 +496,16 @@ class EnvironmentProvisioner {
);
return state;
}
+ // On macOS the developer tools exist for ONE reason here: Homebrew needs
+ // them to build tmux. A machine that already has a working tmux has
+ // nothing to build, and must not be sent to a Terminal to fix a
+ // toolchain it will never use — that is how a desk with tmux 3.6 sat on
+ // "Xcode is installed but is not the active developer directory" while
+ // the app waited (2026-09-15: the real cause was an unaccepted Xcode
+ // licence, which xcrun reports as "not ready" too).
+ final tmuxAlready = _isMacOS && await _hasTmux();
var systemReady = _isMacOS
- ? await _hasAppleDeveloperTools()
+ ? (tmuxAlready || await _hasAppleDeveloperTools())
: linuxMissingBasePackages.isEmpty;
emit(
systemReady: systemReady,
@@ -508,7 +516,9 @@ class EnvironmentProvisioner {
]
: const [],
output: systemReady
- ? '✓ required system tools · writable home'
+ ? (tmuxAlready && !await _hasAppleDeveloperTools()
+ ? '✓ tmux already installed · Apple developer tools not needed'
+ : '✓ required system tools · writable home')
: _isMacOS
? '✗ Apple developer tools · xcrun --find clang'
: '✗ missing Linux base packages · ${linuxMissingBasePackages.join(', ')}',
@@ -542,8 +552,9 @@ class EnvironmentProvisioner {
final homebrewReady = !_isMacOS || await _hasHomebrew();
var tmuxBinaryReady = await _hasTmux();
- var tmuxReady =
- tmuxBinaryReady && (!_isMacOS || (homebrewReady && systemReady));
+ // A tmux that runs is a tmux that is ready. Homebrew and the developer
+ // tools are what INSTALL it; they gate nothing once it is there.
+ var tmuxReady = tmuxBinaryReady;
emit(
step: EnvironmentStep.tmux,
status: tmuxReady
@@ -1350,9 +1361,10 @@ fi''';
}
Future<bool> _isTmuxEnvironmentReady() async {
+ if (await _hasTmux()) return true; // installed is ready, whatever built it
if (_isMacOS && !await _hasAppleDeveloperTools()) return false;
if (_isMacOS && !await _hasHomebrew()) return false;
- return _hasTmux();
+ return false;
}
/// `xcode-select -p` only proves that a path was selected. It also succeeds
@@ -1398,11 +1410,24 @@ trap finish EXIT
apple_developer_tools_ready() {
/usr/bin/xcrun --find clang >/dev/null 2>&1
}
+if command -v tmux >/dev/null 2>&1; then
+ echo 'tmux is already installed. Return to Harness.'
+ exit 0
+fi
if ! apple_developer_tools_ready; then
if [ -x /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild ]; then
- echo 'Xcode is installed but is not the active developer directory.'
- echo 'macOS may ask for your password to select it.'
- sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
+ # xcrun answers "not ready" for two different reasons, and only one of them is the developer
+ # directory. An unaccepted Xcode licence exits 69 and no amount of xcode-select fixes it.
+ if ! /usr/bin/xcodebuild -license check >/dev/null 2>&1; then
+ echo 'Xcode is installed but its licence has not been accepted.'
+ echo 'macOS may ask for your password to accept it.'
+ sudo /usr/bin/xcodebuild -license accept
+ fi
+ if ! apple_developer_tools_ready; then
+ echo 'Xcode is installed but is not the active developer directory.'
+ echo 'macOS may ask for your password to select it.'
+ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
+ fi
else
echo 'Apple developer tools are missing. Installing Command Line Tools; finish the macOS dialog to continue.'
xcode-select --install || true
diff --git a/desktop/test/environment_provisioner_test.dart b/desktop/test/environment_provisioner_test.dart
index 62be1f6d6..3839f19d7 100644
--- a/desktop/test/environment_provisioner_test.dart
+++ b/desktop/test/environment_provisioner_test.dart
@@ -161,7 +161,11 @@ void main() {
},
);
- test('an unusable selected developer directory is shown as missing during pre-flight', () async {
+ test('an installed tmux is ready whatever the developer tools say', () async {
+ // The developer tools exist to BUILD tmux. With tmux already there, an
+ // unusable toolchain — an unselected directory, an unaccepted licence —
+ // must not stand between the person and the app; it did, for a whole
+ // morning, on a desk with tmux 3.6 and an Xcode licence never clicked.
var terminalLaunches = 0;
final calls = <String>[];
final provisioner = EnvironmentProvisioner(
@@ -181,6 +185,33 @@ void main() {
install: false,
);
+ expect(readiness.systemReady, isTrue);
+ expect(readiness.tmuxBinaryReady, isTrue);
+ expect(readiness.steps[EnvironmentStep.tmux], EnvironmentStepStatus.ready);
+ expect(readiness.output.join('\n'), contains('tmux already installed'));
+ expect(terminalLaunches, 0);
+ });
+
+ test('an unusable selected developer directory is shown as missing when tmux is absent', () async {
+ var terminalLaunches = 0;
+ final calls = <String>[];
+ final provisioner = EnvironmentProvisioner(
+ harnessHome: scratch,
+ isMacOS: true,
+ isLinux: false,
+ openTerminal: (_) async => terminalLaunches++,
+ run: runner(
+ developerToolsPresent: false,
+ tmuxPresent: () => false,
+ calls: calls,
+ ),
+ );
+
+ final readiness = await provisioner.ensureReady(
+ onProgress: (_) {},
+ install: false,
+ );
+
expect(readiness.phase, EnvironmentSetupPhase.review);
expect(readiness.systemReady, isFalse);
expect(readiness.output.join('\n'), contains('xcrun --find clang'));
@@ -227,6 +258,8 @@ void main() {
),
);
expect(script, contains('xcode-select --install'));
+ expect(script, contains('xcodebuild -license accept'));
+ expect(script, contains("tmux is already installed"));
expect(script, contains('did not become ready within 10 minutes'));
expect(script, contains('if ! command -v tmux'));
if (File('/bin/zsh').existsSync()) {