The pgctl copy schema command requires pg_dump to be installed and available in your system PATH. This tool is part of the PostgreSQL client tools package.
# Install PostgreSQL (includes pg_dump)
brew install postgresql
# Or install just the client tools
brew install libpq
# Add PostgreSQL bin directory to PATH if not already added
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcsudo port install postgresql16 +universal- Download and install PostgreSQL.app
- Add the command line tools to your PATH:
echo 'export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc# Update package list
sudo apt update
# Install PostgreSQL client tools
sudo apt install postgresql-client
# For a specific version (e.g., PostgreSQL 16)
sudo apt install postgresql-client-16# CentOS/RHEL 8+
sudo dnf install postgresql
# CentOS/RHEL 7
sudo yum install postgresql
# Fedora
sudo dnf install postgresqlsudo pacman -S postgresqlapk add postgresql-client- Download the PostgreSQL installer from postgresql.org
- Run the installer and make sure to select "Command Line Tools" during installation
- Add the PostgreSQL bin directory to your PATH:
- Typically located at:
C:\Program Files\PostgreSQL\16\bin
- Typically located at:
# Using Chocolatey
choco install postgresql
# Using Scoop
scoop install postgresqlAfter installation, verify that pg_dump is available:
pg_dump --versionYou should see output similar to:
pg_dump (PostgreSQL) 16.1
The pgctl copy schema command includes automatic version compatibility checking. It's recommended to use a pg_dump version that is the same or newer than your PostgreSQL server version for best compatibility.
| PostgreSQL Server | pg_dump Version | Status |
|---|---|---|
| 13.x | 13.x+ | ✅ Supported |
| 14.x | 14.x+ | ✅ Supported |
| 15.x | 15.x+ | ✅ Supported |
| 16.x | 16.x+ | ✅ Supported |
If you get a "command not found" error for pg_dump:
- Check if PostgreSQL is installed: Run
which pg_dumporwhere pg_dump(Windows) - Update PATH: Make sure the PostgreSQL bin directory is in your PATH
- Reinstall: Try reinstalling PostgreSQL client tools
If you encounter permission issues:
# On macOS/Linux, ensure you have proper permissions
sudo chown -R $(whoami) /usr/local/var/postgresql/If you get version compatibility warnings:
- Update pg_dump: Install a newer version of PostgreSQL client tools
- Check server version: Connect to your PostgreSQL server and run
SELECT version(); - Use compatible versions: Ensure pg_dump version ≥ PostgreSQL server version
If you're using PostgreSQL in Docker, you can also use pg_dump from a Docker container:
# Run pg_dump from PostgreSQL Docker image
docker run --rm -it postgres:16 pg_dump --version
# Use it in place of local pg_dump (create an alias)
alias pg_dump='docker run --rm -i postgres:16 pg_dump'If you continue to experience issues with pg_dump installation:
- Check the PostgreSQL documentation
- Verify your operating system's package manager documentation
- Ensure you have the necessary permissions to install software
- Consider using Docker as an alternative installation method
For pgctl-specific issues, please refer to the main project documentation or open an issue in the project repository.