pg 1.5.3

Ruby gem: pg

Install This Version

Using gem command

gem install pg -v 1.5.3

In your Gemfile

gem 'pg', '~> 1.5.3'

Frequently Asked Questions

How do I lock the pg gem at version 1.5.3?

To lock this gem at this specific version, update your Gemfile:

gem 'pg', '1.5.3'

Then run:

bundle install

Note: This is an older version. Consider upgrading to the latest version (1.6.2) for the newest features and security fixes.

Docker Installation

Alpine Linux

FROM alpine:latest

# Install Ruby and build tools
RUN apk add --no-cache ruby ruby-dev build-base

# Install system dependencies
RUN apk add --no-cache \
    openssl-dev \
    postgresql-client \
    postgresql-dev

# Note: The following dependencies do not have package lists for alpine:
# - libruby (canonical: libruby)

# Install the gem
RUN gem install pg -v 1.5.3

# Verify installation
RUN ruby -e "require 'pg'; puts 'Successfully loaded pg'"

Arch Linux

FROM archlinux:latest

# Install Ruby and build tools
RUN pacman -Sy --noconfirm ruby base-devel

# Install system dependencies
RUN pacman -Sy --noconfirm \
    openssl \
    postgresql-libs

# Note: The following dependencies do not have package lists for arch:
# - libruby (canonical: libruby)

# Install the gem
RUN gem install pg -v 1.5.3

# Verify installation
RUN ruby -e "require 'pg'; puts 'Successfully loaded pg'"

Debian

FROM debian:bookworm-slim

# Install Ruby and build tools
RUN apt-get update -qq && apt-get install -y --no-install-recommends ruby ruby-dev build-essential

# Install system dependencies
RUN apt-get update -qq && \
    apt-get install -y --no-install-recommends     libssl-dev    postgresql-client    libpq-dev&& \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Note: The following dependencies do not have package lists for debian:
# - libruby (canonical: libruby)

# Install the gem
RUN gem install pg -v 1.5.3

# Verify installation
RUN ruby -e "require 'pg'; puts 'Successfully loaded pg'"

Fedora

FROM fedora:latest

# Install Ruby and build tools
RUN dnf install -y ruby ruby-devel gcc gcc-c++ make

# Install system dependencies
RUN dnf install -y \
    openssl-devel \
    postgresql \
    libpq-devel && \
    dnf clean all

# Note: The following dependencies do not have package lists for fedora:
# - libruby (canonical: libruby)

# Install the gem
RUN gem install pg -v 1.5.3

# Verify installation
RUN ruby -e "require 'pg'; puts 'Successfully loaded pg'"

Ubuntu

FROM ubuntu:24.04

# Install Ruby and build tools
RUN apt-get update -qq && apt-get install -y --no-install-recommends ruby ruby-dev build-essential

# Install system dependencies
RUN apt-get update -qq && \
    apt-get install -y --no-install-recommends     libssl-dev    postgresql-client    libpq-dev&& \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Note: The following dependencies do not have package lists for ubuntu:
# - libruby (canonical: libruby)

# Install the gem
RUN gem install pg -v 1.5.3

# Verify installation
RUN ruby -e "require 'pg'; puts 'Successfully loaded pg'"

Nixpacks

Deploy with Nixpacks (Railway, Render, etc.)

# nixpacks.toml for pg 1.5.3

[phases.setup]
# System dependencies:
aptPkgs = ["libssl-dev", "postgresql-client", "libpq-dev"]

# Note: The following dependencies do not have package lists for debian:
# - libruby (canonical: libruby)

[phases.install]
cmds = ["gem install pg -v 1.5.3"]

[phases.build]
cmds = ["ruby -e \"require 'pg'; puts 'Successfully loaded pg'\""]

Save this as nixpacks.toml in your project root.

Cloud Native Buildpacks

Deploy with Cloud Native Buildpacks (Heroku, Paketo, etc.)

# package.toml for pg 1.5.3
# Cloud Native Buildpacks configuration

# System dependencies:
[[build.env]]
name = "BP_APT_PACKAGES"
value = "libssl-dev postgresql-client libpq-dev"

# Note: The following dependencies do not have package lists for debian:
# - libruby (canonical: libruby)

# Gem installation will be handled by the Ruby buildpack
# which automatically installs gems from Gemfile or bundler

Save this as package.toml in your project root.

Nix Shell

Develop with Nix using ruby-nixpkgs

# shell.nix for pg 1.5.3
# Usage: nix-shell
# Uses ruby-nixpkgs for gem management

{ pkgs ? import <nixpkgs> {} }:

let
  rubyVersion = pkgs.ruby_3_3;

  # Ruby environment with ruby-nixpkgs
  rubyEnv = pkgs.bundlerEnv {
    name = "pg-1.5.3";
    ruby = rubyVersion;
    gemdir = ./.;
  };
in

pkgs.mkShell {
  buildInputs = [
    rubyVersion
    pkgs.bundler
    pkgs.ruby-nixpkgs

    # System dependencies
    pkgs.postgresql

    # Note: The following dependencies do not have package lists for nixpkgs:
    # - libruby (canonical: libruby)
    # - openssl (canonical: openssl)
  ];

  shellHook = ''
    echo "Ruby environment for pg 1.5.3"
    echo "Use: gem install pg -v 1.5.3"
  '';
}

Save this as shell.nix in your project root, then run nix-shell.

Devenv

Develop with Devenv for declarative development environments

# devenv.nix for pg 1.5.3
# Usage: devenv shell

{ pkgs, lib, config, ... }:

{
  languages.ruby = {
    enable = true;
    version = "3.3.0";
  };

  packages = [
    pkgs.postgresql

    # Note: The following dependencies do not have package lists for nixpkgs:
    # - libruby (canonical: libruby)
    # - openssl (canonical: openssl)
  ];

  enterShell = ''
    echo "Development environment for pg 1.5.3"
    echo "Use: gem install pg -v 1.5.3"
  '';
}

Save this as devenv.nix in your project root, then run devenv shell.

Nix Flakes

Develop with Nix Flakes for reproducible development environments

# flake.nix for pg 1.5.3
# Usage: nix develop

{
  description = "Development environment for pg 1.5.3";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        rubyVersion = pkgs.ruby_3_3;
      in
      {
        devShells.default = pkgs.mkShell {
          buildInputs = [
            rubyVersion
            pkgs.bundler

            # System dependencies
            pkgs.postgresql

            # Note: The following dependencies do not have package lists for nixpkgs:
            # - libruby (canonical: libruby)
            # - openssl (canonical: openssl)
          ];

          shellHook = ''
            echo "Development environment for pg 1.5.3"
            echo "Use: gem install pg -v 1.5.3"
          '';
        };
      }
    );
}

Save this as flake.nix in your project root, then run nix develop.

Other Versions