Skip to content

Commit fb95345

Browse files
author
petrnovota
committed
Install Homebrew and Git only if not installed already
1 parent 8e1c96f commit fb95345

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

docs/source/_static/install_dependencies.sh

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,26 @@ lookup_debian_version_number() {
155155
}
156156

157157
if [[ $(uname) == "Darwin" ]]; then
158-
echo "During Homebrew install, certain commands need 'sudo'. Requesting access..."
159-
sudo true
160-
homebrew_install_url="https://raw.githubusercontent.com/Homebrew/install/master/install.sh"
161-
print_action "Installing Homebrew from $homebrew_install_url"
162-
# CI=1 will skip some interactive prompts
163-
CI=1 /bin/bash -c "$(curl -fsSL $homebrew_install_url)"
164-
print_and_exec brew install git
165-
echo
166-
echo "=== Installed successfully! IMPORTANT: For changes to take effect,"
167-
echo "please close and reopen the terminal window, or run: exec \$SHELL"
158+
if ! command -v brew &> /dev/null; then
159+
echo "During Homebrew install, certain commands need 'sudo'. Requesting access..."
160+
sudo true
161+
homebrew_install_url="https://raw.githubusercontent.com/Homebrew/install/master/install.sh"
162+
print_action "Installing Homebrew from $homebrew_install_url"
163+
# CI=1 will skip some interactive prompts
164+
CI=1 /bin/bash -c "$(curl -fsSL $homebrew_install_url)"
165+
echo
166+
echo "=== Installed successfully! IMPORTANT: For changes to take effect,"
167+
echo "please close and reopen the terminal window, or run: exec \$SHELL"
168+
else
169+
echo "Homebrew is already installed."
170+
fi
171+
172+
if ! command -v git &> /dev/null; then
173+
echo "Git not found, installing using Homebrew..."
174+
print_and_exec brew install git
175+
else
176+
echo "Git Already installed.."
177+
fi
168178

169179
elif [ -f /etc/os-release ]; then
170180
source /etc/os-release

0 commit comments

Comments
 (0)