Skip to content

macOS: build with RUNTIME_PREFIX for a relocatable dist - #4

Merged
jochenhz merged 1 commit into
mainfrom
fix-macos-runtime-prefix
Jun 16, 2026
Merged

macOS: build with RUNTIME_PREFIX for a relocatable dist#4
jochenhz merged 1 commit into
mainfrom
fix-macos-runtime-prefix

Conversation

@jochenhz

@jochenhz jochenhz commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Problem

build_git_macos ran make install prefix=/ without RUNTIME_PREFIX, baking the absolute exec-path //libexec/git-core into the binary. A portable dist then can't locate its own libexec/git-core unless it happens to be extracted at /:

  • git --exec-path returns //libexec/git-core regardless of where the binary lives
  • non-builtins like git lfs fail ("not a git command")

The Windows asset was unaffected because config.mak.uname auto-enables RUNTIME_PREFIX for Windows/MinGW targets — but not for Darwin.

Fix

Add RUNTIME_PREFIX=YesPlease to the macOS make invocation. Darwin already auto-enables HAVE_NS_GET_EXECUTABLE_PATH, so this single flag is sufficient — git resolves its prefix from the binary's own path at runtime. prefix=/ keeps gitexecdir relative (libexec/git-core), satisfying the Makefile's relative-path requirement for RUNTIME_PREFIX.

Test plan

Rebuilt arm64 with the change and verified from a relocated copy:

  • git --exec-path/tmp/reloc/libexec/git-core (tracks the move; previously fixed at //libexec/git-core)
  • git lfs versiongit-lfs/3.7.1 (Anchorpoint; darwin arm64; …), exit 0
  • GIT-BUILD-OPTIONS shows RUNTIME_PREFIX='true'

Both arm64 + x64 archives were rebuilt, re-notarized (Accepted), and the corrected assets published to v2.54.0.anchorpoint.1 (Windows asset untouched).

🤖 Generated with Claude Code

The macOS build ran `make install prefix=/` without RUNTIME_PREFIX, which
bakes the absolute exec-path //libexec/git-core into the binary. The portable
dist then cannot locate its own libexec/git-core unless extracted at /, so
`git --exec-path` reports //libexec/git-core regardless of the binary's
location and non-builtins like `git lfs` fail with "not a git command".

config.mak.uname auto-enables RUNTIME_PREFIX only for Windows/MinGW targets
(why MinGit / the Windows asset was always relocatable), not Darwin. Darwin
does auto-enable HAVE_NS_GET_EXECUTABLE_PATH, so RUNTIME_PREFIX=YesPlease
alone is sufficient: git derives its prefix from the binary's own path at
runtime.

Verified on a relocated copy: `git --exec-path` tracks the new location and
`git lfs version` resolves the bundled Anchorpoint fork.
@jochenhz
jochenhz force-pushed the fix-macos-runtime-prefix branch from c787a2c to 8c8e56d Compare June 1, 2026 12:39
@jochenhz
jochenhz merged commit 8c8e56d into main Jun 16, 2026
1 of 4 checks passed
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.

1 participant