Last active
January 5, 2023 09:24
-
-
Save abn/07cc147bafb85d3b8ab5f53d1e239926 to your computer and use it in GitHub Desktop.
Install homebrew from behind a proxy on Mac OS X.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Based on: http://godlessheathenmemoirs.blogspot.com.au/2015/03/homebrew-aka-brew-on-mac-os-x-behind.html | |
function usage() { | |
echo 2>&1 "" | |
echo 2>&1 "usage: $(basename $0) PROXY_HOST PROXY_PORT" | |
exit 1 | |
} | |
PROXY_HOST=${PROXY_HOST:-$1} | |
PROXY_PORT=${PROXY_PORT:-$2} | |
[ -z "${PROXY_HOST}" ] && { echo 1>&2 "PROXY_HOST not defined"; usage; } | |
[ -z "${PROXY_PORT}" ] && { echo 1>&2 "PROXY_PORT not defined"; usage; } | |
PROXY_URI=${PROXY_HOST}:${PROXY_PORT} | |
# export proxy environment configurations | |
declare -x HTTPS_PROXY="http://${PROXY_URI}" | |
declare -x HTTP_PROXY="http://${PROXY_URI}" | |
declare -x http_proxy="http://${PROXY_URI}" | |
declare -x https_proxy="http://${PROXY_URI}" | |
# ignore TLS issues when cloning from git (homebrew) | |
declare -x GIT_SSL_NO_VERIFY="1" | |
# there really should be a better way; sigh | |
# source: https://brew.sh/ | |
ruby -e "$(curl -x http://${PROXY_URI} -fsSL -k https://raw.githubusercontent.com/Homebrew/install/master/install)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
update to the new url /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"