Solution to failure to install PostgreSQL when following Engineering Elixir Applications book

I’m starting to follow the book Engineering Elixir Applications, and immediately ran into an issue installing PostgreSQL 15.2 on macOS 15.4.1:

note: 'strchrnul' has been marked as being introduced in macOS 15.4 here, but the deployment target is macOS 15.0.0

Apparently this issue affects macOS 15.4.0+, and has been fixed in a PostgreSQL patch for versions 13-17, but that patch doesn’t seem out yet (at least for 15).

For now, I managed to install it by exporting the following line first, before the asdf install (page 9 of the book):

export MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion)"

Note that I’m using mise instead of asdf, but I believe the same issue will be present with asdf as mise just uses the asdf postgres plugin.

Details of the issue for anyone interested:

I originally found the pgenv solution, which linked to the above bug discussion:

I hope this helps people.

Apparently this issue affects macOS 15.4.0+, and has been fixed in a PostgreSQL patch for versions 13-17, but that patch doesn’t seem out yet (at least for 15).

For now, I managed to install it by exporting the following line first, before the asdf install (page 9 of the book):

export MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion)"
1 Like

Just use docker compose. It’s so much easier to manage various projects that require different versions of services like postgres, mysql, redis, etc.

1 Like

Thanks, this helped me out when I had to setup a new company laptop!

1 Like

This might be a better solution long term but a) I’m not overly familiar with Docker (which is partly why I’m reading this book), and b) I was trying to follow the book as close as possible.

There’s always a tension when following technical books; if you deviate too far, you might run into issues you need to diagnose yourself and that might be challenging depending on the nature of the issue and your experience level. At the same time, books can date fast, so you might run into similar issues when following the book directly anyway. Since this book is relatively new, I expected minimal to no issues following the book directly, but the recent macOS update obviously had an impact.

1 Like