Setting up Apache Age with PostgreSQL: A Comprehensive Installation Guide for MacOS (Part 1)
Published: 2023-08-09 11:32:11

Listed below are the steps outlining the procedure for setting up Apache AGE with PostgreSQL:

**PostgreSQL Installation:** Begin by installing PostgreSQL. A PostgreSQL database must be installed before commencing work with Apache AGE.

**Apache AGE Installation:** Following the successful installation of PostgreSQL, proceed to install Apache AGE by adhering to the guidelines presented in the official documentation.

**Apache AGE Configuration:** Once Apache AGE is installed, it necessitates configuration to interface with your PostgreSQL database. This typically involves adjusting configuration files to define database connection details and other preferences.

**Relational Database Visualization:** After completing the installation and configuration, initiate the visualization of relational databases using Apache AGE.

**Note:** The precise steps for Apache AGE installation and configuration may differ based on your operating system and PostgreSQL version. Refer to the official documentation for precise guidance.

## **Prerequisites:**

**Accessing the Bash Shell:** To access the bash shell, perform the following steps:

Launch the terminal or command line interface on your system.
Enter the command "bash" and press enter to enter the bash shell.
Alternatively, on certain systems, you can select the "Open Terminal" option, right-click on the desktop, and specify "bash" as the preferred shell.
Git Installation: Prior to proceeding, ensure Git is already installed. If not, utilize the subsequent instructions for installation:

**Visit the official Git website:** https://git-scm.com/downloads
Download the suitable Git version for your operating system.
Follow the installation guidelines for your operating system to complete the process.
For further assistance, consult the official Git documentation or other resources.
**Dependency Installation:**
To install dependencies, execute the ensuing steps:

Create a new directory.
Within this directory, establish a sub-directory.
In the sub-directory, Apache Age will be installed.

`mkdir age_installation
cd age_installation
mkdir pg
cd pg`

For downloading essential libraries needed to install Apache Age on macOS, implement the subsequent steps:

**Homebrew Installation:** Homebrew is a widely-used package manager for macOS, streamlining the installation of libraries and tools.

`/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"`

Follow the terminal prompts to complete Homebrew installation.

**Library Installation:** Following Homebrew installation, employ the ensuing command in the terminal to install the requisite libraries for Apache Age:

`brew install build-essential libreadline zlib flex bison`

This command will install the libraries: build-essential, libreadline, zlib, flex, and bison, making the necessary libraries available for Apache Age on macOS.

**Individual Dependency Installation:**
For separate installation of the dependencies needed for Apache Age on macOS, Homebrew can be employed to install the required libraries as follows:

1. **Install libreadline:**
`brew install libreadline`

2. **Install zlib:**
`brew install zlib`

3. **Install flex:**
`brew install flex`

4. **Install bison:**
`brew install bison`

**PostgreSQL Source Installation:**
Installation of PostgreSQL 12 on macOS entails the subsequent steps:

File Download and Extraction: Employ the terminal to download and extract the PostgreSQL 12 files.

`curl -O https://ftp.postgresql.org/pub/source/v12.0/postgresql-12.0.tar.gz && tar -xvf postgresql-12.0.tar.gz && rm -f postgresql-12.0.tar.gz`

**Installation Procedure:** Proceed with the installation of PostgreSQL 12 by adhering to the guidelines found in the official documentation at the link: https://www.postgresql.org/docs/current/install-procedure.html

**PostgreSQL Installation:**
Continuing with the Postgres installation process:

`cd postgresql-12.0
# configure
./configure
# install
make install
# return
cd ../../`

**AGE Installation:**
Download AGE from the GitHub repository, specifically cloning it into the Apache_age directory:

`git clone https://github.com/apache/age.git`

**Installation:**
Configure AGE with PostgreSQL and execute the installation commands:

`cd age/
sudo make PG_CONFIG=/Users/damil/Apache_age/postgres/postgresql-12.0/bin/pg_config install;
make PG_CONFIG=/Users/damil/Apache_age/postgres/postgresql-12.0/bin/pg_config installcheck;`

In the above commands, ensure that PG_CONFIG specifies the path to the pg_config file. The second command is used to verify the success of the installation.

## References

Apache-Age:-https://age.apache.org/
GitHub:-(https://github.com/apache/age
https://github.com/git-guides/install-git
https://age.apache.org/age-manual/master/intro/setup.html
https://www.postgresql.org/docs/current/install-procedure.html