Puma and PostgreSQL crash on M1 mac, Ruby on Rails 6.1

Have you encounter following bug when booting your M1 Mac machine when running PostgreSQL, Puma and Ruby on Rails application, this bug is frustrating but there is a really simple solution to this problem, which is to disable PGGSSENCMODE.

Solution:

export PGGSSENCMODE="disable"

put above code in your ~/.zshrc or ~/.bashrc file depending on which shell you are using.

I am using Zsh

echo $SHELL
/usr/bin/zsh

And finally, don't forget to reload your terminal, or restart your terminal.

source ~/.zshrc
rails s

It should fix that crash issue.