I encounted same error on Rails 7.1.1.
to fix psych’s installation, i exec brew install libyaml and bundle install