Skip to content

Commit ac864a2

Browse files
authored
Merge pull request #71 from NikolayS/docs/add-macos-install-instructions
docs: add macOS installation instructions for psql and pspg
2 parents 4bea088 + a0bfbbd commit ac864a2

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,61 @@ Questions? Ideas? Contact me: [email protected], Nikolay Samokhvalov.
1616

1717
**postgres_dba** is based on useful queries created and improved by many developers. Here is incomplete list of them:
1818
* Jehan-Guillaume (ioguix) de Rorthais https://github.com/ioguix/pgsql-bloat-estimation
19-
* Alexey Lesovsky, Alexey Ermakov, Maxim Boguk, Ilya Kosmodemiansky et al. from Data Egret (aka PostgreSQL-Consulting) https://github.com/dataegret/pg-utils
19+
* Alexey Lesovsky, Alexey Ermakov, Maxim Boguk, Ilya Kosmodemiansky et al. https://github.com/dataegret/pg-utils
2020
* Josh Berkus, Quinn Weaver et al. from PostgreSQL Experts, Inc. https://github.com/pgexperts/pgx_scripts
2121

2222
## Requirements
2323

2424
**You need to have psql version 10 or newer**, but the Postgres server itself can be older – most tools work with it.
2525
You can install the latest postgresql-client library on your machine and use it to work with older Postgres servers – in this case postgres_dba will work. It's recommended to use psql from PostgreSQL 18 (the latest release) for the best compatibility.
2626

27+
### Installing on Ubuntu
28+
2729
On clean Ubuntu, this is how you can get postgresql-client and have the most recent psql:
28-
```
30+
```bash
2931
sudo sh -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main\" >> /etc/apt/sources.list.d/pgdg.list"
3032
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3133
sudo apt-get update
3234
sudo apt-get install -y postgresql-client-18
3335
```
3436

35-
Using alternative psql pager called "pspg" is highly recommended (but not required): https://github.com/okbob/pspg.
37+
### Installing on macOS
38+
39+
On macOS, use Homebrew to install PostgreSQL client and pspg:
40+
41+
```bash
42+
# Install PostgreSQL client (includes psql)
43+
brew install libpq
44+
45+
# Add libpq to PATH (required because it's keg-only)
46+
echo 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' >> ~/.zshrc
47+
source ~/.zshrc
48+
49+
# For Intel Macs, use:
50+
# echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.zshrc
51+
52+
# Verify installation
53+
psql --version
54+
55+
# Install pspg (recommended pager)
56+
brew install pspg
57+
```
58+
59+
Alternatively, you can install the full PostgreSQL package which includes psql:
60+
```bash
61+
brew install postgresql@18
62+
```
63+
64+
### pspg - Enhanced psql Pager (Optional)
65+
66+
Using alternative psql pager called "pspg" is highly recommended but optional: https://github.com/okbob/pspg.
67+
68+
After installing pspg, configure it in your `~/.psqlrc`:
69+
```bash
70+
\setenv PAGER pspg
71+
\pset border 2
72+
\pset linestyle unicode
73+
```
3674

3775
## Supported PostgreSQL Versions
3876

@@ -52,7 +90,7 @@ The installation is trivial. Clone the repository and put "dba" alias to your `.
5290
```bash
5391
git clone https://github.com/NikolayS/postgres_dba.git
5492
cd postgres_dba
55-
printf "%s %s %s %s\n" \\echo 🧐 🐘 'postgres_dba 6.0 installed. Use ":dba" to see menu' >> ~/.psqlrc
93+
printf "%s %s %s %s\n" \\echo 🧐 🐘 'postgres_dba 18.0 installed. Use ":dba" to see menu' >> ~/.psqlrc
5694
printf "%s %s %s %s\n" \\set dba \'\\\\i $(pwd)/start.psql\' >> ~/.psqlrc
5795
```
5896

0 commit comments

Comments
 (0)