#!/bin/bash if ! command -v brew >/dev/null 2>&1; then echo "Homebrew is not installed. Please install Homebrew first: https://brew.sh/" exit 1 fi if ! brew list openscad >/dev/null 2>&1; then brew install openscad fi if ! [ -d ~/Documents/OpenSCAD/libraries/ ]; then mkdir -p ~/Documents/OpenSCAD/libraries/ fi cd ~/Documents/OpenSCAD/libraries/ declare -A libraries=( ["BOSL2"]="https://github.com/BelfrySCAD/BOSL2.git" ["BOSL"]="https://github.com/revarbat/BOSL.git" ["MCAD"]="https://github.com/openscad/MCAD.git" ["BOLTS"]="https://github.com/boltsparts/BOLTS.git" ["nutsnbolts"]="https://github.com/JohK/nutsnbolts.git" ["openscad-fillets"]="https://github.com/jfhbrook/openscad-fillets.git" ["openscad-model-library"]="https://github.com/cznewt/openscad-model-library.git" ["OpenSCAD-Arduino-Mounting-Library"]="https://github.com/kellyegan/OpenSCAD-Arduino-Mounting-Library.git" ["BezierScad"]="https://github.com/chadkirby/BezierScad.git" ["OpenSCAD-Track"]="https://github.com/joostn/OpenSCAD-Track.git" ["Chamfers-for-OpenSCAD"]="https://github.com/SebiTimeWaster/Chamfers-for-OpenSCAD.git" ["openjscad-u-joints"]="https://github.com/celer/openjscad-u-joints.git" ) for lib in "${!libraries[@]}"; do if ! [ -d "$lib" ]; then git clone "${libraries[$lib]}" else cd "$lib" git pull cd .. fi done if ! command -v openscad >/dev/null 2>&1; then echo "OpenSCAD installation failed. Please verify your Homebrew setup." exit 1 fi for lib in "${!libraries[@]}"; do if [ ! -d "$lib" ]; then echo "Library $lib setup failed. Verify git and directory permissions." exit 1 fi done echo "OpenSCAD and libraries successfully installed and configured."