From 41f658b1edc58d6d0725091c1f12491c032f0a87 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Fri, 10 Nov 2023 17:11:09 +0100 Subject: [PATCH] Update mac os script for pg15 (#2427) * Update mac os script for pg15 * Update mac os script for pg15 * Update mac os script for pg15 --- infra/dev/scripts/setup-postgres-macos.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/infra/dev/scripts/setup-postgres-macos.sh b/infra/dev/scripts/setup-postgres-macos.sh index d3ff1afef9..b354ab7fe7 100755 --- a/infra/dev/scripts/setup-postgres-macos.sh +++ b/infra/dev/scripts/setup-postgres-macos.sh @@ -56,7 +56,7 @@ current_directory=$(pwd) # Install PostgresSQL echo_header $GREEN "Step [1/4]: Installing PostgreSQL..." -brew install postgresql@$PG_MAIN_VERSION +brew reinstall postgresql@$PG_MAIN_VERSION # Install pg_graphql extensions echo_header $GREEN "Step [2/4]: Installing GraphQL for PostgreSQL..." @@ -65,7 +65,7 @@ echo_header $GREEN "Step [2/4]: Installing GraphQL for PostgreSQL..." curl https://sh.rustup.rs -sSf | sh source "$HOME/.cargo/env" cargo install --locked cargo-pgrx@$CARGO_PGRX_VERSION -cargo pgrx init --pg14 download +cargo pgrx init --pg$PG_MAIN_VERSION download # Uninstall existing Rust installation if found existing_rust_path=$(which rustc) @@ -88,9 +88,9 @@ curl -LJO https://github.com/supabase/pg_graphql/archive/refs/tags/v$PG_GRAPHQL_ unzip pg_graphql-$PG_GRAPHQL_VERSION.zip cd "pg_graphql-$PG_GRAPHQL_VERSION" -cargo pgrx install --release +cargo pgrx install --release --pg-config /opt/homebrew/opt/postgresql@$PG_MAIN_VERSION/bin/pg_config -# Clean up the temporary directory +# # Clean up the temporary directory echo "Cleaning up..." cd "$current_directory" rm -rf "$temp_dir" @@ -98,10 +98,7 @@ rm -rf "$temp_dir" # Start postgresql service echo_header $GREEN "Step [3/4]: Starting PostgreSQL service..." -if ! command -v brew &> /dev/null; then - echo_header $RED "Warning: Homebrew is not found in your PATH. Adding it to PATH..." - export PATH="/opt/homebrew/bin:$PATH" -fi +[[ ":$PATH:" != *":/opt/homebrew/opt/postgresql@$PG_MAIN_VERSION/bin:"* ]] && PATH="/opt/homebrew/opt/postgresql@$PG_MAIN_VERSION/bin:${PATH}" if brew services start postgresql@$PG_MAIN_VERSION; then echo "PostgreSQL service started successfully."