Skip to content

Commit d7c22d2

Browse files
authored
Merge pull request #1053 from luxonis/fix/depthai_installer_for_mac
Fix/depthai installer for mac
2 parents 837a361 + 1f0f851 commit d7c22d2

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

docs/source/_static/install_dependencies.sh

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ readonly fedora_pkgs=(
117117
# libsm6 libxext6 libgl1-mesa-glx
118118
)
119119

120+
# Check Bash version
121+
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
122+
echo "This script requires Bash 4.0 or higher. You are using Bash ${BASH_VERSION}. Please upgrade your Bash version."
123+
exit 1
124+
fi
125+
120126
print_action () {
121127
green="\e[0;32m"
122128
reset="\e[0;0m"
@@ -155,16 +161,26 @@ lookup_debian_version_number() {
155161
}
156162

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

169185
elif [ -f /etc/os-release ]; then
170186
source /etc/os-release

docs/source/_static/install_depthai.sh

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mkdir "$WORKING_DIR"
77
install_path=""
88
path_correct="false"
99

10-
trap 'RET=$? ; echo -e >&2 "\n\x1b[31mFailed installing dependencies. Could be a bug in the installer or unsupported platform. Open a bug report over at https://github.com/luxonis/depthai - exited with status $RET at line $LINENO \x1b[0m\n" ; exit $RET' ERR
10+
trap 'RET=$? ; echo -e >&2 "\n\x1b[31mFailed installing depthai. Could be a bug in the installer or unsupported platform. Open a bug report over at https://github.com/luxonis/depthai - exited with status $RET at line $LINENO \x1b[0m\n" ; exit $RET' ERR
1111

1212
while [ "$path_correct" = "false" ]
1313
do
@@ -127,9 +127,6 @@ if [[ $(uname -s) == "Darwin" ]]; then
127127
echo "Installing global dependencies."
128128
bash -c "$(curl -fL https://docs.luxonis.com/install_dependencies.sh)"
129129

130-
echo "Upgrading brew."
131-
brew update
132-
133130
# clone depthai form git
134131
if [ -d "$DEPTHAI_DIR" ]; then
135132
echo "Demo app already downloaded. Checking out main and updating."
@@ -142,20 +139,13 @@ if [[ $(uname -s) == "Darwin" ]]; then
142139
git checkout main
143140
git pull
144141

145-
# install python 3.10 and python dependencies
146-
brew update
147142

148143
if [ "$install_python" == "true" ]; then
149144
echo "installing python 3.10"
150145
brew install [email protected]
151146
python_executable=$(which python3.10)
152147
fi
153148

154-
# pip does not have pyqt5 for arm
155-
if [[ $(uname -m) == 'arm64' ]]; then
156-
echo "Installing pyqt5 with homebrew."
157-
brew install pyqt@5
158-
fi
159149

160150
# create python virtual environment
161151
echo "Creating python virtual environment in $VENV_DIR"
@@ -166,20 +156,14 @@ if [[ $(uname -s) == "Darwin" ]]; then
166156
python -m pip install --upgrade pip
167157

168158
# install launcher dependencies
169-
# only on mac silicon point PYTHONPATH to pyqt5 installation via homebrew, otherwise install pyqt5 with pip
170-
if [[ $(uname -m) == 'arm64' ]]; then
171-
if [[ ":$PYTHONPATH:" == *":/opt/homebrew/lib/python3.10/site-packages:"* ]]; then
172-
echo "/opt/homebrew/lib/python$nr_1.$nr_2/site-packages already in PYTHONPATH"
173-
else
174-
export "PYTHONPATH=/opt/homebrew/lib/python$nr_1.$nr_2/site-packages:"$PYTHONPATH
175-
echo "/opt/homebrew/lib/pythonv$nr_1.$nr_2/site-packages added to PYTHONPATH"
176-
fi
177-
else
178-
pip install pyqt5
179-
fi
180-
159+
pip install pyqt5
181160
pip install packaging
182161

162+
# Inform macOS users about PATH changes
163+
echo "DepthAI has been added to your PATH in .bashrc and .zshrc (if present)."
164+
echo "If you prefer, you can manually add the following line to your .bash_profile for it to be recognized in login shells:"
165+
echo "export PATH=\$PATH:$ENTRYPOINT_DIR"
166+
183167
elif [[ $(uname -s) == "Linux" ]]; then
184168
echo _____________________________
185169
echo "Calling linux_installer.sh"

0 commit comments

Comments
 (0)