Skip to content

Improve macOS executable fallback for Homebrew paths#49721

Open
froggy-hyun wants to merge 2 commits intospring-projects:mainfrom
froggy-hyun:main
Open

Improve macOS executable fallback for Homebrew paths#49721
froggy-hyun wants to merge 2 commits intospring-projects:mainfrom
froggy-hyun:main

Conversation

@froggy-hyun
Copy link
Copy Markdown

@froggy-hyun froggy-hyun commented Mar 24, 2026

Summary

Improve macOS process startup fallback by supporting both Homebrew bin locations:

  • /opt/homebrew/bin (default on Apple Silicon)
  • /usr/local/bin (default on Intel macOS; also common in older or Rosetta-based setups)

Problem

Some macOS code paths retried process startup using only /usr/local/bin.
On Apple Silicon systems, executables installed via Homebrew are typically located under
/opt/homebrew/bin, so process startup could fail when PATH is restricted or does not
include that location.

Changes

  • Added OPT_HOMEBREW_BIN as an additional fallback alongside the existing USR_LOCAL_BIN.
  • Updated macOS fallback handling in:
    • core/spring-boot-docker-compose ProcessRunner
    • test-support DisabledIfProcessUnavailableCondition
    • buildpack CredentialHelper
  • Updated CredentialHelperTests to verify that both fallback candidates are attempted.

Why this is low risk

  • Behavior change is limited to macOS code paths guarded by OS checks.
  • Windows and Linux behavior is unchanged.
  • Existing /usr/local/bin fallback behavior is preserved.

Verification

Executed with JDK 25:

  • :buildpack:spring-boot-buildpack-platform:test --tests org.springframework.boot.buildpack.platform.docker.configuration.CredentialHelperTests
  • :test-support:spring-boot-test-support:test --tests org.springframework.boot.testsupport.process.DisabledIfProcessUnavailableTests
  • :core:spring-boot-docker-compose:test --tests org.springframework.boot.docker.compose.core.ProcessRunnerTests
  • :core:spring-boot-docker-compose:checkstyleMain
  • :test-support:spring-boot-test-support:checkstyleMain
  • :buildpack:spring-boot-buildpack-platform:checkstyleMain

All tests and checks passed.

Add /opt/homebrew/bin as an additional macOS fallback location (alongside
/usr/local/bin) when starting external processes.

The previous fallback assumed /usr/local/bin only, which can fail on Apple
Silicon Homebrew setups in restricted PATH environments (for example IDE or
GUI-launched processes).

Apply the same fallback behavior to:
- docker compose process runner
- DisabledIfProcessUnavailable condition
- docker credential helper startup

Also update CredentialHelperTests to verify both macOS fallback paths are
attempted.

Signed-off-by: 1233day <1233day@naver.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 24, 2026
Comment on lines +107 to +110
private String getCommandName(String command) {
int lastSlash = command.lastIndexOf('/');
return (lastSlash != -1) ? command.substring(lastSlash + 1) : command;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to falling back to an additional path. It's also unnecessary as @DisabledIfProcessUnavailable is never used with slashes in the command names as that would likely hurt their portability. Please revert.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I reverted the command-name extraction and kept the change focused on adding the additional macOS fallback path only.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Mar 25, 2026
- Remove the helper methods introduced for extracting command/executable names
  and keep this change focused on adding /opt/homebrew/bin as an additional
  macOS fallback path

Signed-off-by: 1233day <1233day@naver.com>
@snicoll snicoll removed status: waiting-for-feedback We need additional information before we can continue labels Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants