---
title: "pg gem on Ubuntu 22"
url: https://michalasobczak.pl/posts/pg-gem-on-ubuntu-22.html
author: "Michał Sobczak"
description: "I thought that installing pg gem on my clean Ubuntu 22 will be easy, but no. I got some weird message: So I tried to force installation: After this: On this Ubuntu 22 release installing Ruby interpreter from packages you got 3.0.2p107."
published: 2022-12-02T09:02:20.000Z
updated: 2022-12-02T09:02:20.000Z
language: en
categories: ["Technology"]
tags: ["Ruby", "Ubuntu"]
license: CC BY-NC-ND 4.0 (https://creativecommons.org/licenses/by-nc-nd/4.0/)
---
# pg gem on Ubuntu 22

I thought that installing pg gem on my clean Ubuntu 22 will be easy, but no. I got some weird message:

```bash
The following packages have unmet dependencies:
 libpq-dev : Depends: libpq5 (= 14.5-0ubuntu0.22.04.1) but 15.1-1.pgdg22.04+1 is to be installed
E: Unable to correct problems, you have held broken packages
```

So I tried to force installation:

```bash
sudo apt-get install libpq5=14.5-0ubuntu0.22.04.
```

After this:

```bash
sudo apt install libpq-dev
sudo gem install pg
```

On this Ubuntu 22 release installing Ruby interpreter from packages you got 3.0.2p107. The problem might be because of pgadmin4 which I installed before, so it could break something.
