Skip to content
This repository has been archived by the owner on Aug 6, 2022. It is now read-only.

Mac toolchain updates #406

Merged
merged 2 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions tools/init_macos.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
# Source this file to prepare a mac for running scripts
hash greadlink 2>/dev/null || { echo >&2 "Required tool greadlink is not installed, please run 'brew install coreutils'"; exit 1; }
hash gfind 2>/dev/null || { echo >&2 "Required tool gfind is not installed, please run 'brew install findutils'"; exit 1; }
hash gsed 2>/dev/null || { echo >&2 "Required tool gsed is not installed, please run 'brew install gnu-sed'"; exit 1; }
hash greadlink 2>/dev/null || {
echo >&2 "Required tool greadlink is not installed, please run 'brew install coreutils'"
exit 1
}
hash gfind 2>/dev/null || {
echo >&2 "Required tool gfind is not installed, please run 'brew install findutils'"
exit 1
}
hash gsed 2>/dev/null || {
echo >&2 "Required tool gsed is not installed, please run 'brew install gnu-sed'"
exit 1
}

TOOL_PREFIX="$(brew --prefix)/bin"

if [[ ! -d /tmp/docker-solr-bin ]]; then
mkdir -p /tmp/docker-solr-bin >/dev/null 2>&1
ln -s /usr/local/bin/greadlink /tmp/docker-solr-bin/readlink
ln -s /usr/local/bin/gfind /tmp/docker-solr-bin/find
ln -s /usr/local/bin/gsed /tmp/docker-solr-bin/sed
ln -s $TOOL_PREFIX/greadlink /tmp/docker-solr-bin/readlink
ln -s $TOOL_PREFIX/gfind /tmp/docker-solr-bin/find
ln -s $TOOL_PREFIX/gsed /tmp/docker-solr-bin/sed
fi

if [[ ! $PATH == *"docker-solr-bin"* ]]; then
export PATH=/tmp/docker-solr-bin:$PATH
echo "Configuring for macOS - adding /tmp/docker-solr-bin first in path"
fi
fi
3 changes: 2 additions & 1 deletion update.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ You also need the GNU version of some tools.
```bash
brew install gpg # If you don't have GPG already
brew install git # If you don't have git already
brew install coreutils wget gawk shellcheck bash parallel findutils # Other dependencies
brew install coreutils wget gawk shellcheck bash parallel findutils gnu-sed # Other dependencies
sudo wget -nv --output-document=/usr/local/bin/bashbrew https://github.com/docker-library/bashbrew/releases/download/v0.1.1/bashbrew-darwin-amd64
sudo chmod a+x /usr/local/bin/bashbrew
```

Before you start running scripts, please run an init script that puts GNU tools first in PATH. The settings only takes effect for the current Terminal window:

```bash
source tools/init_macos.sh
```
Expand Down