diff --git a/dev/macos/README.md b/dev/macos/README.md new file mode 100644 index 0000000..7cf4289 --- /dev/null +++ b/dev/macos/README.md @@ -0,0 +1,52 @@ +## macOS installation methods + +- install redis and postgresql + +```bash +./install.sh +``` + +- build pgroonga + +```bash +./build-pgroonga.sh +``` + +- start redis and postgresql + +```bash +./start-postgres.sh + +# and +./start-redis.sh +``` + +- setup detabase + +* create db and user + +```bash +psql -d postgres -U $USER +``` + +```sql +-- Create a new PostgreSQL user named 'firefish' with encrypted password. +-- This user will not have superuser, createdb, or createrole privileges. +CREATE USER firefish WITH ENCRYPTED PASSWORD 'password' SUPERUSER NOCREATEDB NOCREATEROLE; + +-- Create a new database named 'firefish_db' with UTF8 encoding and owned by the 'firefish' user. +CREATE DATABASE firefish_db WITH ENCODING 'UTF8' OWNER firefish; + +``` + +- enable pgroonga extension + +```bash +# enter this command then type password +psql -U firefish -d firefish_db -W +``` + +```sql +-- This ensures the PGroonga extension is enabled for the database. +CREATE EXTENSION pgroonga; +``` diff --git a/dev/macos/build-pgroonga.sh b/dev/macos/build-pgroonga.sh new file mode 100755 index 0000000..4d4a07e --- /dev/null +++ b/dev/macos/build-pgroonga.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +sudo -v +brew install groonga + +git clone --recursive https://github.com/pgroonga/pgroonga.git --depth 1 +cd pgroonga +make +sudo make install diff --git a/dev/macos/install.sh b/dev/macos/install.sh new file mode 100755 index 0000000..6d01b35 --- /dev/null +++ b/dev/macos/install.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +brew install redis +brew install postgresql@16 diff --git a/dev/macos/start-postgres.sh b/dev/macos/start-postgres.sh new file mode 100755 index 0000000..2c1ed4c --- /dev/null +++ b/dev/macos/start-postgres.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH" + +export LDFLAGS="-L/opt/homebrew/opt/postgresql@16/lib" +export CPPFLAGS="-I/opt/homebrew/opt/postgresql@16/include" +export PKG_CONFIG_PATH="/opt/homebrew/opt/postgresql@16/lib/pkgconfig" + +LC_ALL="C" /opt/homebrew/opt/postgresql@16/bin/postgres -D /opt/homebrew/var/postgresql@16 diff --git a/dev/macos/start-redis.sh b/dev/macos/start-redis.sh new file mode 100755 index 0000000..4191188 --- /dev/null +++ b/dev/macos/start-redis.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +redis-server