Skip to content

Commit 02c4f7a

Browse files
authored
Merge pull request #1456 from roycaihw/sed-check
Add OS X sed check to update-submodule.sh
2 parents 88841db + bb7bb64 commit 02c4f7a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

scripts/update-submodule.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@ set -o errexit
3131
set -o nounset
3232
set -o pipefail
3333

34+
# OS X sed doesn't support "--version". This way we can tell if OS X sed is
35+
# used.
36+
if ! sed --version &>/dev/null; then
37+
# OS X sed and GNU sed aren't compatible with backup flag "-i". Namely
38+
# sed -i ... - does not work on OS X
39+
# sed -i'' ... - does not work on certain OS X versions
40+
# sed -i '' ... - does not work on GNU
41+
echo ">>> OS X sed detected, which may be incompatible with this script. Please install and use GNU sed instead:
42+
$ brew install gnu-sed
43+
$ brew info gnu-sed
44+
# Find the path to the installed gnu-sed and add it to your PATH. The default
45+
# is:
46+
# PATH=\"/Users/\$USER/homebrew/opt/gnu-sed/libexec/gnubin:\$PATH\""
47+
exit 1
48+
fi
49+
3450
repo_root="$(git rev-parse --show-toplevel)"
3551
declare -r repo_root
3652
cd "${repo_root}"

0 commit comments

Comments
 (0)