# This was tested on MacOS 10.13 # set up some variables to reduce redundancy _SCH_VERSION='14.21.02' _SCH_BNAME="schemacrawler-${_SCH_VERSION}-distribution" _SCH_TNAME="/tmp/${SCH_BNAME}.zip" _SCH_URL="https://github.com/schemacrawler/SchemaCrawler/releases/download/v${_SCH_VERSION}/${_SCH_BNAME}.zip" _SCH_DIR='/usr/local/opt/schemacrawler' _SCH_SH="${_SCH_DIR}/schemacrawler-macos-opt.sh" # Download and unzip into /tmp curl -Lo ${_SCH_TNAME} ${_SCH_URL} unzip ${_SCH_TNAME} # Move subdir from release package into /usr/local/opt mkdir -p ${_SCH_DIR} cp -r /tmp/${_SCH_BNAME}/_schemacrawler/ ${_SCH_DIR} # create the shell script manually echo '#!/usr/bin/env bash' > ${_SCH_SH} echo "SC_DIR=${_SCH_DIR}" >> ${_SCH_SH} echo "java -cp \$(echo \$SC_DIR/lib/*.jar | tr ' ' ':'):\$SC_DIR/config schemacrawler.Main \"\$@\"" \ >> ${_SCH_SH} # make it executable and symlink it chmod +x ${_SCH_SH} ln -sf ${_SCH_SH} /usr/local/bin/schemacrawler