Last active
March 29, 2023 15:26
-
-
Save Nezteb/cfd701ddadd4eed523dd2f5f5f8a65a3 to your computer and use it in GitHub Desktop.
Installing rsql on M2 Mac with macOS Ventura?
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
rsql() { | |
# https://docs.aws.amazon.com/redshift/latest/mgmt/rsql-query-tool-getting-started.html | |
# https://stackoverflow.com/questions/38670295/homebrew-refusing-to-link-openssl | |
# https://www.deepanseeralan.com/tech/openssl-dev-on-macOS/ | |
BREW_PREFIX=$(brew --BREW_PREFIX openssl@1.1) | |
RSQL_OPENSSL_PATH="/usr/local/opt/openssl@1.1/lib" | |
LIB="/usr/local/lib" | |
export PATH="$BREW_PREFIX/bin:$PATH" | |
export LDFLAGS="-L$BREW_PREFIX/lib" | |
export CPPFLAGS="-I$BREW_PREFIX/include" | |
export PKG_CONFIG_PATH="$BREW_PREFIX/lib/pkgconfig" | |
sudo mkdir -p "$RSQL_OPENSSL_PATH" | |
sudo ln -s "$BREW_PREFIX/lib/libssl.1.1.dylib" "$RSQL_OPENSSL_PATH" &> /dev/null || true | |
sudo ln -s "$BREW_PREFIX/lib/libcrypto.1.1.dylib" "$RSQL_OPENSSL_PATH" &> /dev/null || true | |
sudo ln -s "$BREW_PREFIX/lib/libssl.1.1.dylib" "$LIB" &> /dev/null || true | |
sudo ln -s "$BREW_PREFIX/lib/libcrypto.1.1.dylib" "$LIB" &> /dev/null || true | |
# TODO: Still getting error: "dyld[80807]: Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib" | |
# TODO: ... "(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))" | |
# TODO: I don't think AWS has an ARM64 version of rsql yet... | |
# TODO: How do I force brew to install a x86_64 version of openssl@1.1? | |
/usr/local/bin/rsql "$@" | |
EXIT=$? | |
# Remove symlinks afterwards in case they break anything | |
sudo rm -f "$RSQL_OPENSSL_PATH/libssl.1.1.dylib" &> /dev/null || true | |
sudo rm -f "$RSQL_OPENSSL_PATH/libcrypto.1.1.dylib" &> /dev/null || true | |
sudo rm -f "$LIB/libssl.1.1.dylib" &> /dev/null || true | |
sudo rm -f "$LIB/libcrypto.1.1.dylib" &> /dev/null || true | |
return $EXIT | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment