Use sudo with make install:
Since you're modifying system-wide directories like /usr/local/pgsql, you might need superuser privileges. Try running the make install command using sudo:
sudo make install
This should execute the installation process with elevated permissions, allowing it to remove the old age.so and install the new one
Check Ownership and Permissions:
Since you've already tried changing ownership using sudo chown /usr/local/pgsql, but make sure you're using the correct username and that the ownership change was successful. Also, ensure that the permissions are set correctly on the lib directory and its contents.
sudo chown -R /usr/local/pgsql
sudo chmod -R 755 /usr/local/pgsql
Replace the with your username
Remove the Existing File Manually:
If you're still facing permission issues, you can try manually removing the existing age.so file before running make install.
sudo rm /usr/local/pgsql/lib/age.so
After removing the file, try running make install again.
Use make clean:
You can use make clean command to clean the build before trying the installation again. After that, try the installation process again using sudo make install.
Hope it helps!