Skip to content

Conversation

zhkgo
Copy link

@zhkgo zhkgo commented Sep 16, 2025

Description

This pull request corrects a command in a setup script that fails to parse configuration values correctly on macOS. Specifically, when attempting to extract the MongoDB version from config/overleaf.rc, the existing sed command returns the entire line MONGO_VERSION=7.0 instead of the required value 7.0.

The issue originates from fundamental differences between the GNU sed implementation (common on Linux) and the BSD sed implementation (used by macOS). The script's regular expression relies on behavior specific to GNU sed, causing the substitution to fail silently on macOS.

To resolve this and enhance script portability, this change replaces the non-portable sed command with the universally available cut command. The modified pipeline continues to use grep to isolate the target line, but then passes the result to cut. Using the equals sign = as a delimiter, cut cleanly extracts the version value. This approach is simple, avoids the complexities of cross-platform regular expressions, and guarantees consistent behavior across both Linux and macOS environments.

Related issues / Pull Requests

Fixes a developer setup issue on macOS where environment variables are not parsed correctly.

Contributor Agreement

for sed command MacOs Output like
MONGO_VERSION=7.0
RightOut Is
7.0
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