Skip to content

fix: replace sed -i with perl -pi for macOS compatibility#14990

Open
skjnldsv wants to merge 1 commit into
masterfrom
fix/sed-macos-compat
Open

fix: replace sed -i with perl -pi for macOS compatibility#14990
skjnldsv wants to merge 1 commit into
masterfrom
fix/sed-macos-compat

Conversation

@skjnldsv
Copy link
Copy Markdown
Member

☑️ Resolves

Summary

merge-folders in user_manual/Makefile used sed -i -e to rewrite
_images and _static paths in the built HTML. macOS BSD sed requires
a backup-extension argument with -i (e.g. sed -i ''), while GNU sed
does not accept an empty extension — there is no single flag spelling
that works on both.

Replace both invocations with perl -pi -e, which handles in-place
edits portably on Linux and macOS.

Before:

find ./ -type f -exec sed -i -e 's/_images/..\/_images/g' {} \;
find ./ -type f -exec sed -i -e 's/_static/..\/_static/g' {} \;

After:

find ./ -type f -exec perl -pi -e 's|_images|../_images|g' {} \;
find ./ -type f -exec perl -pi -e 's|_static|../_static|g' {} \;

Note: the add-lang-to-versions-template-% target mentioned in the
issue title was already removed in a prior refactor commit
(c40d359041). The remaining sed -i usage (in merge-folders) is
the last occurrence of this macOS-incompatible pattern.

🖼️ Screenshots

N/A — Makefile change only, no visual output affected.

✅ Checklist

  • I have built the documentation locally and reviewed the output
  • Screenshots are included for visual changes (N/A)
  • I have not moved or renamed pages (or added a redirect if I did)
  • I have run codespell or similar and addressed any spelling issues

macOS BSD sed requires a backup extension with -i (e.g. sed -i ''),
while GNU sed does not accept an empty extension. The merge-folders
target used sed -i -e which fails on macOS with:

  sed: 1: "<file>": invalid command code .

Replace with perl -pi -e which is portable across both platforms.

Fixes #13186

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

📖 Documentation Preview

🔍 Open preview →

No RST documentation pages changed in this PR.

Last updated: Thu, 21 May 2026 11:03:04 GMT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix sed Command Compatibility Issue in add-lang-to-versions-template-% Target on macOS

1 participant