rails / rails

Ruby on Rails

Home Page:https://rubyonrails.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called

conradwt opened this issue · comments

Steps to reproduce

rails new testapp -d postgresql
cd testapp
rails g scaffold post title body:text
rails db:migrate
rails c
irb(main):001:0> Post.create(title: "This is a test 1", body:  "This is a body 1")

Expected behavior

I would expect to get a response saying that the Post was successfully created.

Actual behavior

objc[18501]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[18501]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

System configuration

Rails version: Rails 6.0.2.1

Ruby version: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]

@conradwt thanks for reporting the issue, if you run bin/rails s do you get the same error?

I have had this same issue a number of times, usually when I'm updating the o/s version (on Mac), you may have to add something like the below into your bash file.

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

@hahmed I'm not seeing an issue with bin/rails s. However, I'm still seeing the issue even when using

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

Thank you for the report but this is an issue between ruby and MacOS. Could you please report to ruby?

@rafaelfranca I’ll notify my students of this issue because they are all experiencing it at this time. Thus, I have them to hold-off on using rails c and related commands until the issue is resolved. Thanks for the feedback to this issue.

I'm also getting this error :(

For me, adding below to ~/.bash_profile works.
export DISABLE_SPRING=true

I can confirm that when running rails test on Apple M1 Max (16-inch 2021, Rails 6.0, Ruby 2.6.8) we got this error as well:

objc[3982]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[3982]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

Solved by disabling spring completely. Thank you!

commented

Also getting this error on 14" M1 Max. But not on my Mac Mini M1 🤔

Also getting this error on 14" M1 Max. But not on my Mac Mini M1 🤔

Same here, works on Mac Mini M1 but not on M1 Max. Disabling Spring works.

same here with M1 Max, rails 4.2, ruby 2.6.8 doesn't work.

Disabling spring doesn't help

M1 Pro, PARALLEL_WORKERS=2 + file attachments in system tests: produces this error (spring has been disabled)

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES helped!

commented

I was getting the same error using Rails 6.1.4.1 and ruby-2.7.5 [ arm64 ]. Setting export DISABLE_SPRING=true fixed the issue.

Setting export export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES helped in my case. The other suggestion, export DISABLE_SPRING=true had no effect. Environment: M1 Max, Rails 7.0.0, Ruby 3.0.3.

same here, export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES solve the problem. I got this problem after upgrading hubspot-api-client to 10.1.1 M1 Max, Ruby 2.7.4 Rails 6.0.4

Started happening when I changed from ImageMagick to Vips

Adding

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

In my .env fixed the problem.

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

is working like charm 🎉 love you all guys 😃

For context this is the Ruby issue for this, it would be fixed in more recent versions of Ruby, so I suggest upgrading Ruby if possible

Setting export export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES helped in my case. The other suggestion, export DISABLE_SPRING=true had no effect. Environment: M1 Max, Rails 7.0.0, Ruby 3.0.3.

Same here, had to OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES and it's all gravy baby

For anyone coming across this, I don't think this is an Apple silicon + Ruby issue, as I get exactly the same error when using vips (imagemagick is fine) with Active Storage on an Intel i5 Mac running macOS 12.4 with Ruby 2.7.4.

Using OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fixed the issue for me temporarily, but I'll be upgrading Ruby too as the long-term fix.

I was getting the same error using Rails 6.1.4.1 and ruby-2.7.5 [ arm64 ]. Setting export DISABLE_SPRING=true fixed the issue.

this works fine

This started happening for me after installing the debase gem through RubyMine and allowing it to add a global Spring config at ~/.spring.rb. If you've done this recently, remove the global config and restart Spring.

M1 Pro, Rails 6.1, Ruby 2.7

exporting the environment variable seems to fork and to a point it makes sense

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES does not solve the issue for me, ruby 3.1.2p20 rails 7.0.4, M1 MBP

  • added it to .zshrc and source ~/.zshrc, still no luck
  • not using spring in the project
  • no luck with bin/rails s

UPDATE: fixed by opening a new terminal window after adding export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES to .zshrc. Reloading with source didn't work. Thanks @mauro-oto

For anyone coming across this, I don't think this is an Apple silicon + Ruby issue, as I get exactly the same error when using vips (imagemagick is fine) with Active Storage on an Intel i5 Mac running macOS 12.4 with Ruby 2.7.4.

Using OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fixed the issue for me temporarily, but I'll be upgrading Ruby too as the long-term fix.

Same here, forcing rails 7 to use config.active_storage.variant_processor = :mini_magick fixed the issue. I will monitor the issue in order to get back to vips.

For me, adding below to ~/.zshrc works.
export DISABLE_SPRING=true

It suddenly happened yesterday on my M1 Max Rails 7.0.4.3 Ruby 3.1.4

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fixed the issue but I'm not sure why everything was fine just 2 days ago.

For anyone coming across this, I don't think this is an Apple silicon + Ruby issue, as I get exactly the same error when using vips (imagemagick is fine) with Active Storage on an Intel i5 Mac running macOS 12.4 with Ruby 2.7.4.
Using OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fixed the issue for me temporarily, but I'll be upgrading Ruby too as the long-term fix.

Same here, forcing rails 7 to use config.active_storage.variant_processor = :mini_magick fixed the issue. I will monitor the issue in order to get back to vips.

It started again yesterday from nothing. My setup is ruby 3.2.2, rails 7.0.5 on a 2.4 GHz 8-Core Intel Core i9 with Ventura 13.4.

BJC_DISABLE_INITIALIZE_FORK_SAFETY=YES worked for me.

I'm not able to reproduce my original issue using Rails 7.0.5, Ruby 3.2.2, and macOS 13.4 (Ventura) using Apple M1 Max MacBook Pro. For example,

rails new testapp -d postgresql
cd testapp
rails g scaffold post title body:text
rails db:create
rails db:migrate
rails c
irb(main):001:0> Post.create(title: "This is a test 1", body:  "This is a body 1")
 TRANSACTION (0.1ms)  BEGIN
  Post Create (1.0ms)  INSERT INTO "posts" ("title", "body", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"  [["title", "This is a test 1"], ["body", "This is a body 1"], ["created_at", "2023-06-20 20:46:44.365315"], ["updated_at", "2023-06-20 20:46:44.365315"]]
  TRANSACTION (0.6ms)  COMMIT
=> #<Post:0x000000010e057d78 id: 1, title: "This is a test 1", body: "This is a body 1", created_at: Tue, 20 Jun 2023 20:46:44.365315000 UTC +00:00, updated_at: Tue, 20 Jun 2023 20:46:44.365315000 UTC +00:00>
irb(main):002:0> quit

However, I'll definitely leave this issue open because others are still having this issue.

This problem also randomly cropped up for me in macOS Ventura 13.4.0 and it seems to have gone away after upgrading to macOS 13.4.1

I upgraded to 13.4.1 but unfortunately the issue is still happening.

Be sure that "OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" is always present in environmet variables since you run your app.

  1. export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
  2. env
  3. launch my app

I was also confused why it's not working but finally OBJC_DISABLE_INITIALIZE_FORK_SAFETY was not present in env.

Setting export export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES helped in my case. The other suggestion, export DISABLE_SPRING=true had no effect. Environment: M1 Max, Rails 7.0.0, Ruby 3.0.3.

It works for me
reboot as well

commented

I encountered this issue while using bundle exec rails db:drop in development.

I think this might be related to some multithreading issues, because before stopping my application (using RubyMine) the db:drop command caused the database is being accessed by other users error.
After I stopped it, the _NSCFConstantString initialize error appeared, and trying DISABLE_SPRING=true caused the database is being accessed by other users to reappear.

In my case, spamming killall ruby until the No matching processes belonging to you were found message appears fixed the problem without any reboot or exports.

spring stop solved it for me. I ran into this after updating to MacOS 13.5. My guess is that spring never restarted during/after the update and got into a wonky state.

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

The above worked for me. I placed it in my ~/.bashrc or ~/.bash_profile or ~/.zprofile
Did: source ~/.bashrc
NB: Source the file you updated
Open a new terminal
Start your server afresh

I have also started running into this.

Initial environment:

  • macOS 13.4.1
  • Ruby 3.0.2
  • Rails 6.1.4
  • spring 2.1.1
  • bootsnap 1.7.7

Things I have tried:

  • Upgraded to macOS 13.5
  • Upgraded to Rubies 3.0.6, 3.1.4, 3.2.2
  • Upgraded to Rails 6.1.7.4
  • Upgraded to spring 4.1.1
  • Upgraded to bootsnap 1.16.0

Even with all those updates in place, I'm still getting the error below:

Running via Spring preloader in process 77233
objc[77233]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[77233]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

Either removing Spring or setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes does seem to resolve the issue, but I'd rather not disable Spring (for speed) and I have no idea what OBJC_DISABLE_INITIALIZE_FORK_SAFETY does, so I'm unsure about setting this permanently on my machine.

Can anyone point me to more information about what OBJC_DISABLE_INITIALIZE_FORK_SAFETY does? Anything named "something something disable safety" sounds like it ought not to be disabled...

@jcarlson have you tried stopping and restarting Spring?

@gabeodess-sana yes I have. Also tried restarting my machine.

Some additional digging suggests this might be related to upgrading PG from 10 => 14 in the not so distant past.

ged/ruby-pg#538
ged/ruby-pg#311

@jcarlson I recommend using pg instead of ruby-pg gem here. I haven't seen any issues with using the pg gem with PostgreSQL 14 or 15.

@jcarlson All I could find out about that variable is the comment in an apple header file:

disable safety checks for +initialize after fork

And that they seem to be using it in their apache httpd distribution

I'd not set this globally, but putting it right before the command should be fine if it keeps you working while this bug is not fixed in ruby.

@conradwt I'm having this issue with pg and PostgreSQL 15.

@jcarlson Just performed a quick check and I'm not using spring or Node in any of my recent Rails 7 applications.

@conradwt I am using pg gem in my application. pg @ 1.2.3 with Posgresql 14.5 via a Docker container (previously 10.14).

So... this is one of the more bizarre root causes I have seen in my Ruby career, but TL;DR: this failure case depends on which version of PostgreSQL is installed and linked on my system at the time the pg gem is installed.

Observe:

Begin with a known working state:

$ rake test
Running via Spring preloader in process 44790
Run options: --seed 12349

# Running:

......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Finished in 6.880380s, 107.8429 runs/s, 157.6948 assertions/s.
742 runs, 1085 assertions, 0 failures, 0 errors, 0 skips

Now, stop Spring, change out PostgreSQL versions, and try again:

$ spring stop
Spring stopped.

$ gem uninstall pg
Successfully uninstalled pg-1.2.3

$ brew unlink postgresql@10
Unlinking /opt/homebrew/Cellar/postgresql@10/10.22_6... 167 symlinks removed.

$ brew link postgresql@14
Linking /opt/homebrew/Cellar/postgresql@14/14.8_2... 334 symlinks created.


$ bundle install
Fetching gem metadata from https://rubygems.org/
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://enterprise.contribsys.com/
Fetching gem metadata from https://enterprise.contribsys.com/..
...omitted for brevity...
Fetching pg 1.2.3
Installing pg 1.2.3 with native extensions
Bundle complete! 41 Gemfile dependencies, 135 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

$ rake test
Running via Spring preloader in process 45999
objc[45999]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[45999]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

@jcarlson Maybe you should report this to the maintainers of the pg gem at https://github.com/ged/ruby-pg - I think that they are probably better equipped to look at this.

Also there was a similar issue with the Ruby interpreter itself at https://bugs.ruby-lang.org/issues/14009 for more context

Thanks @nertzy I will see if I can get something in to the ruby-pg project.

It looks like the upstream cause of this issue is documented here, and has to do with changes in the krb5 Homebrew package. There's a lot of "it's not me, it's you" happening between the pg gem, Homebrew, Postgres itself, and so on.

The issue appears to affect only macOS users with PostgreSQL 12 or newer installed via Homebrew.

What I can say, is that I'm able to reproduce this issue trivially on a brand new Rails project using the latest version of everything. I have created a demo repository here.

Given that this issue occurs with a brand new app after 1) swapping sqlite3 for pg and 2) enabling spring for users on a Mac with PostgreSQL 12 or greater installed via Homebrew, this might disproportionately affect newcomers to the Rails space.

I'm a pretty seasoned developer and nearly every resource I could find on Google related to this issue pointed me toward issues that we're years out of date and not helpful, or ended in "won't fix".

I'm not sure if this should be a Spring issue to resolve or a Rails issue to resolve, but I do feel like, in order to keep configuration to a minimum for newcomers, this is something that either Rails or Spring should mitigate automatically, or at least warn the user with instructions on how to resolve it.

Thoughts?

@jcarlson I have downloaded and tested your application and cannot reproduce the issue. Next, I created a new application and simply used the Rails defaults but I wasn't able to reproduce any issues here. BTW, I installed PostgreSQL 15.3 via MacPorts and I have tested it on both Apple Silicon and Intel MacBook Pro machines. Furthermore, I don't use the spring gem in the applications that I build for clients. This app will definitely fork processes. Also, it's not enabled by default for new Rails 7 apps.

I'm thinking that this issue could be a symptom of another issue that's happening in the system. For example, there could be another software process on the system that might be the real culprit here. Thus, I recommend performing an inventory of your system and application when invoking spring. For example, check the processes that spring into action when you invoke spring as well as the gems that are being used in the application. Next, one can disable spring and run the tests. Does this option work for your use case? I have stopped having this and other issues after performing a clean installation of macOS.

@conradwt thanks for taking the time to try and replicate this issue. A couple suggestions that might help:

  • Did you try using a build of Postgresql from Homebrew instead of MacPorts? According to this comment, PG can be built without GSSAPI support, and some package managers already do so, like asdf. I'm unsure what MacPorts provides.
  • If you didn't already, you would need to forcibly reinstall the pg gem after you've installed your PG libraries, since the pg gem has native extensions to build at install time. If you're not seeing this issue, you might be using a cached build of the pg gem that was linked against a different Postgres version. gem install pg -v '1.5.3' should be enough to coerce a rebuild.
  • And obviously... spring stop; rake test, but I'm sure you tried that.

If that doesn't help, I can try setting up a "clean room" macOS in a VM and see if I can isolate what's different on my machine.

@conradwt I created a clean room macOS VM and ran through my test scenario, and I still encountered this issue.

For reference, here's what I did:

  • Create a new macOS Ventura VM with Parallels
  • Install Xcode command line tools: xcode-select --install
  • Install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Load Homebrew into $PATH: eval "$(/opt/homebrew/bin/brew shellenv)"
  • Install packages: brew install rbenv ruby-build postgresql@14
  • Start Postgres: brew services start postgresql@14
  • Load rbenv into $PATH: eval "$(rbenv init - zsh)"
  • Install Ruby 3.2.2: rbenv install 3.2.2; rbenv global 3.2.2; rbenv rehash
  • Confirm Ruby 3.2.2: ruby --version
  • Make new app directory: mkdir testapp && cd testapp
  • Install rails: gem install rails; rbenv rehash
  • Scaffold a new project with Postgres adapter: rails new -d postgresql .
  • Update config/database.yml:
    cat <<-EOF > config/database.yml
      default: &default
        adapter: postgresql
        host: localhost
        pool: 5
        timeout: 5000
    
      development:
        <<: *default
        database: testapp_development
    
      test:
        <<: *default
        database: testapp_test
    EOF
    
  • Scaffold a new model: rails g model Product name:string
  • Initialize database: rake db:setup; rake db:migrate
  • Configure a test:
    cat <<-EOF > test/models/product_test.rb
      require "test_helper"
    
      class ProductTest < ActiveSupport::TestCase
        test "the truth" do
          assert_equal Product.count, 2
        end
      end
    EOF
    
  • Verify test suite passes: rake test
  • Install spring: sed -i '' 's/# gem "spring"/gem "spring"/' Gemfile; bundle install
  • Disable class caching: sed -i '' 's/config.cache_classes = true/config.cache_classes = false/' config/environments/test.rb
  • Generate binstubs: bundle exec spring binstub --all; rbenv rehash
  • Run tests: bin/rake test

It may also be important to note that the database connection string must use a TCP connection, not a Unix socket. The default database.yml configuration omits any host, so pg assumes a local socket. In this case, everything works fine. But add host: localhost to the connection parameters, and it will no longer work.

I have included the entire console session from my virtual machine where I ran through this test case.

Console Output
Last login: Tue Aug  8 11:20:08 on console
developer@developers-Virtual-Machine ~ % xcode-select --install
xcode-select: note: install requested for command line developer tools
developer@developers-Virtual-Machine ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown developer /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R developer:admin /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/developer/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/developer/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R developer /Users/developer/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 245790, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 245790 (delta 0), reused 45 (delta 0), pack-reused 245741
Receiving objects: 100% (245790/245790), 71.04 MiB | 27.04 MiB/s, done.
Resolving deltas: 100% (179841/179841), done.
From https://github.com/Homebrew/brew
 * [new branch]          dependabot/bundler/Library/Homebrew/rubocop-sorbet-0.7.2 -> origin/dependabot/bundler/Library/Homebrew/rubocop-sorbet-0.7.2
 * [new branch]          master                                                   -> origin/master
 * [new tag]             0.1                                                      -> 0.1
 * [new tag]             0.2                                                      -> 0.2
 * [new tag]             0.3                                                      -> 0.3
 * [new tag]             0.4                                                      -> 0.4
 * [new tag]             0.5                                                      -> 0.5
 * [new tag]             0.6                                                      -> 0.6
 * [new tag]             0.7                                                      -> 0.7
 * [new tag]             0.7.1                                                    -> 0.7.1
 * [new tag]             0.8                                                      -> 0.8
 * [new tag]             0.8.1                                                    -> 0.8.1
 * [new tag]             0.9                                                      -> 0.9
 * [new tag]             0.9.1                                                    -> 0.9.1
 * [new tag]             0.9.2                                                    -> 0.9.2
 * [new tag]             0.9.3                                                    -> 0.9.3
 * [new tag]             0.9.4                                                    -> 0.9.4
 * [new tag]             0.9.5                                                    -> 0.9.5
 * [new tag]             0.9.8                                                    -> 0.9.8
 * [new tag]             0.9.9                                                    -> 0.9.9
 * [new tag]             1.0.0                                                    -> 1.0.0
 * [new tag]             1.0.1                                                    -> 1.0.1
 * [new tag]             1.0.2                                                    -> 1.0.2
 * [new tag]             1.0.3                                                    -> 1.0.3
 * [new tag]             1.0.4                                                    -> 1.0.4
 * [new tag]             1.0.5                                                    -> 1.0.5
 * [new tag]             1.0.6                                                    -> 1.0.6
 * [new tag]             1.0.7                                                    -> 1.0.7
 * [new tag]             1.0.8                                                    -> 1.0.8
 * [new tag]             1.0.9                                                    -> 1.0.9
 * [new tag]             1.1.0                                                    -> 1.1.0
 * [new tag]             1.1.1                                                    -> 1.1.1
 * [new tag]             1.1.10                                                   -> 1.1.10
 * [new tag]             1.1.11                                                   -> 1.1.11
 * [new tag]             1.1.12                                                   -> 1.1.12
 * [new tag]             1.1.13                                                   -> 1.1.13
 * [new tag]             1.1.2                                                    -> 1.1.2
 * [new tag]             1.1.3                                                    -> 1.1.3
 * [new tag]             1.1.4                                                    -> 1.1.4
 * [new tag]             1.1.5                                                    -> 1.1.5
 * [new tag]             1.1.6                                                    -> 1.1.6
 * [new tag]             1.1.7                                                    -> 1.1.7
 * [new tag]             1.1.8                                                    -> 1.1.8
 * [new tag]             1.1.9                                                    -> 1.1.9
 * [new tag]             1.2.0                                                    -> 1.2.0
 * [new tag]             1.2.1                                                    -> 1.2.1
 * [new tag]             1.2.2                                                    -> 1.2.2
 * [new tag]             1.2.3                                                    -> 1.2.3
 * [new tag]             1.2.4                                                    -> 1.2.4
 * [new tag]             1.2.5                                                    -> 1.2.5
 * [new tag]             1.2.6                                                    -> 1.2.6
 * [new tag]             1.3.0                                                    -> 1.3.0
 * [new tag]             1.3.1                                                    -> 1.3.1
 * [new tag]             1.3.2                                                    -> 1.3.2
 * [new tag]             1.3.3                                                    -> 1.3.3
 * [new tag]             1.3.4                                                    -> 1.3.4
 * [new tag]             1.3.5                                                    -> 1.3.5
 * [new tag]             1.3.6                                                    -> 1.3.6
 * [new tag]             1.3.7                                                    -> 1.3.7
 * [new tag]             1.3.8                                                    -> 1.3.8
 * [new tag]             1.3.9                                                    -> 1.3.9
 * [new tag]             1.4.0                                                    -> 1.4.0
 * [new tag]             1.4.1                                                    -> 1.4.1
 * [new tag]             1.4.2                                                    -> 1.4.2
 * [new tag]             1.4.3                                                    -> 1.4.3
 * [new tag]             1.5.0                                                    -> 1.5.0
 * [new tag]             1.5.1                                                    -> 1.5.1
 * [new tag]             1.5.10                                                   -> 1.5.10
 * [new tag]             1.5.11                                                   -> 1.5.11
 * [new tag]             1.5.12                                                   -> 1.5.12
 * [new tag]             1.5.13                                                   -> 1.5.13
 * [new tag]             1.5.14                                                   -> 1.5.14
 * [new tag]             1.5.2                                                    -> 1.5.2
 * [new tag]             1.5.3                                                    -> 1.5.3
 * [new tag]             1.5.4                                                    -> 1.5.4
 * [new tag]             1.5.5                                                    -> 1.5.5
 * [new tag]             1.5.6                                                    -> 1.5.6
 * [new tag]             1.5.7                                                    -> 1.5.7
 * [new tag]             1.5.8                                                    -> 1.5.8
 * [new tag]             1.5.9                                                    -> 1.5.9
 * [new tag]             1.6.0                                                    -> 1.6.0
 * [new tag]             1.6.1                                                    -> 1.6.1
 * [new tag]             1.6.10                                                   -> 1.6.10
 * [new tag]             1.6.11                                                   -> 1.6.11
 * [new tag]             1.6.12                                                   -> 1.6.12
 * [new tag]             1.6.13                                                   -> 1.6.13
 * [new tag]             1.6.14                                                   -> 1.6.14
 * [new tag]             1.6.15                                                   -> 1.6.15
 * [new tag]             1.6.16                                                   -> 1.6.16
 * [new tag]             1.6.17                                                   -> 1.6.17
 * [new tag]             1.6.2                                                    -> 1.6.2
 * [new tag]             1.6.3                                                    -> 1.6.3
 * [new tag]             1.6.4                                                    -> 1.6.4
 * [new tag]             1.6.5                                                    -> 1.6.5
 * [new tag]             1.6.6                                                    -> 1.6.6
 * [new tag]             1.6.7                                                    -> 1.6.7
 * [new tag]             1.6.8                                                    -> 1.6.8
 * [new tag]             1.6.9                                                    -> 1.6.9
 * [new tag]             1.7.0                                                    -> 1.7.0
 * [new tag]             1.7.1                                                    -> 1.7.1
 * [new tag]             1.7.2                                                    -> 1.7.2
 * [new tag]             1.7.3                                                    -> 1.7.3
 * [new tag]             1.7.4                                                    -> 1.7.4
 * [new tag]             1.7.5                                                    -> 1.7.5
 * [new tag]             1.7.6                                                    -> 1.7.6
 * [new tag]             1.7.7                                                    -> 1.7.7
 * [new tag]             1.8.0                                                    -> 1.8.0
 * [new tag]             1.8.1                                                    -> 1.8.1
 * [new tag]             1.8.2                                                    -> 1.8.2
 * [new tag]             1.8.3                                                    -> 1.8.3
 * [new tag]             1.8.4                                                    -> 1.8.4
 * [new tag]             1.8.5                                                    -> 1.8.5
 * [new tag]             1.8.6                                                    -> 1.8.6
 * [new tag]             1.9.0                                                    -> 1.9.0
 * [new tag]             1.9.1                                                    -> 1.9.1
 * [new tag]             1.9.2                                                    -> 1.9.2
 * [new tag]             1.9.3                                                    -> 1.9.3
 * [new tag]             2.0.0                                                    -> 2.0.0
 * [new tag]             2.0.1                                                    -> 2.0.1
 * [new tag]             2.0.2                                                    -> 2.0.2
 * [new tag]             2.0.3                                                    -> 2.0.3
 * [new tag]             2.0.4                                                    -> 2.0.4
 * [new tag]             2.0.5                                                    -> 2.0.5
 * [new tag]             2.0.6                                                    -> 2.0.6
 * [new tag]             2.1.0                                                    -> 2.1.0
 * [new tag]             2.1.1                                                    -> 2.1.1
 * [new tag]             2.1.10                                                   -> 2.1.10
 * [new tag]             2.1.11                                                   -> 2.1.11
 * [new tag]             2.1.12                                                   -> 2.1.12
 * [new tag]             2.1.13                                                   -> 2.1.13
 * [new tag]             2.1.14                                                   -> 2.1.14
 * [new tag]             2.1.15                                                   -> 2.1.15
 * [new tag]             2.1.16                                                   -> 2.1.16
 * [new tag]             2.1.2                                                    -> 2.1.2
 * [new tag]             2.1.3                                                    -> 2.1.3
 * [new tag]             2.1.4                                                    -> 2.1.4
 * [new tag]             2.1.5                                                    -> 2.1.5
 * [new tag]             2.1.6                                                    -> 2.1.6
 * [new tag]             2.1.7                                                    -> 2.1.7
 * [new tag]             2.1.8                                                    -> 2.1.8
 * [new tag]             2.1.9                                                    -> 2.1.9
 * [new tag]             2.2.0                                                    -> 2.2.0
 * [new tag]             2.2.1                                                    -> 2.2.1
 * [new tag]             2.2.10                                                   -> 2.2.10
 * [new tag]             2.2.11                                                   -> 2.2.11
 * [new tag]             2.2.12                                                   -> 2.2.12
 * [new tag]             2.2.13                                                   -> 2.2.13
 * [new tag]             2.2.14                                                   -> 2.2.14
 * [new tag]             2.2.15                                                   -> 2.2.15
 * [new tag]             2.2.16                                                   -> 2.2.16
 * [new tag]             2.2.17                                                   -> 2.2.17
 * [new tag]             2.2.2                                                    -> 2.2.2
 * [new tag]             2.2.3                                                    -> 2.2.3
 * [new tag]             2.2.4                                                    -> 2.2.4
 * [new tag]             2.2.5                                                    -> 2.2.5
 * [new tag]             2.2.6                                                    -> 2.2.6
 * [new tag]             2.2.7                                                    -> 2.2.7
 * [new tag]             2.2.8                                                    -> 2.2.8
 * [new tag]             2.2.9                                                    -> 2.2.9
 * [new tag]             2.3.0                                                    -> 2.3.0
 * [new tag]             2.4.0                                                    -> 2.4.0
 * [new tag]             2.4.1                                                    -> 2.4.1
 * [new tag]             2.4.10                                                   -> 2.4.10
 * [new tag]             2.4.11                                                   -> 2.4.11
 * [new tag]             2.4.12                                                   -> 2.4.12
 * [new tag]             2.4.13                                                   -> 2.4.13
 * [new tag]             2.4.14                                                   -> 2.4.14
 * [new tag]             2.4.15                                                   -> 2.4.15
 * [new tag]             2.4.16                                                   -> 2.4.16
 * [new tag]             2.4.2                                                    -> 2.4.2
 * [new tag]             2.4.3                                                    -> 2.4.3
 * [new tag]             2.4.4                                                    -> 2.4.4
 * [new tag]             2.4.5                                                    -> 2.4.5
 * [new tag]             2.4.6                                                    -> 2.4.6
 * [new tag]             2.4.7                                                    -> 2.4.7
 * [new tag]             2.4.8                                                    -> 2.4.8
 * [new tag]             2.4.9                                                    -> 2.4.9
 * [new tag]             2.5.0                                                    -> 2.5.0
 * [new tag]             2.5.1                                                    -> 2.5.1
 * [new tag]             2.5.10                                                   -> 2.5.10
 * [new tag]             2.5.11                                                   -> 2.5.11
 * [new tag]             2.5.12                                                   -> 2.5.12
 * [new tag]             2.5.2                                                    -> 2.5.2
 * [new tag]             2.5.3                                                    -> 2.5.3
 * [new tag]             2.5.4                                                    -> 2.5.4
 * [new tag]             2.5.5                                                    -> 2.5.5
 * [new tag]             2.5.6                                                    -> 2.5.6
 * [new tag]             2.5.7                                                    -> 2.5.7
 * [new tag]             2.5.8                                                    -> 2.5.8
 * [new tag]             2.5.9                                                    -> 2.5.9
 * [new tag]             2.6.0                                                    -> 2.6.0
 * [new tag]             2.6.1                                                    -> 2.6.1
 * [new tag]             2.6.2                                                    -> 2.6.2
 * [new tag]             2.7.0                                                    -> 2.7.0
 * [new tag]             2.7.1                                                    -> 2.7.1
 * [new tag]             2.7.2                                                    -> 2.7.2
 * [new tag]             2.7.3                                                    -> 2.7.3
 * [new tag]             2.7.4                                                    -> 2.7.4
 * [new tag]             2.7.5                                                    -> 2.7.5
 * [new tag]             2.7.6                                                    -> 2.7.6
 * [new tag]             2.7.7                                                    -> 2.7.7
 * [new tag]             3.0.0                                                    -> 3.0.0
 * [new tag]             3.0.1                                                    -> 3.0.1
 * [new tag]             3.0.10                                                   -> 3.0.10
 * [new tag]             3.0.11                                                   -> 3.0.11
 * [new tag]             3.0.2                                                    -> 3.0.2
 * [new tag]             3.0.3                                                    -> 3.0.3
 * [new tag]             3.0.4                                                    -> 3.0.4
 * [new tag]             3.0.5                                                    -> 3.0.5
 * [new tag]             3.0.6                                                    -> 3.0.6
 * [new tag]             3.0.7                                                    -> 3.0.7
 * [new tag]             3.0.8                                                    -> 3.0.8
 * [new tag]             3.0.9                                                    -> 3.0.9
 * [new tag]             3.1.0                                                    -> 3.1.0
 * [new tag]             3.1.1                                                    -> 3.1.1
 * [new tag]             3.1.10                                                   -> 3.1.10
 * [new tag]             3.1.11                                                   -> 3.1.11
 * [new tag]             3.1.12                                                   -> 3.1.12
 * [new tag]             3.1.2                                                    -> 3.1.2
 * [new tag]             3.1.3                                                    -> 3.1.3
 * [new tag]             3.1.4                                                    -> 3.1.4
 * [new tag]             3.1.5                                                    -> 3.1.5
 * [new tag]             3.1.6                                                    -> 3.1.6
 * [new tag]             3.1.7                                                    -> 3.1.7
 * [new tag]             3.1.8                                                    -> 3.1.8
 * [new tag]             3.1.9                                                    -> 3.1.9
 * [new tag]             3.2.0                                                    -> 3.2.0
 * [new tag]             3.2.1                                                    -> 3.2.1
 * [new tag]             3.2.10                                                   -> 3.2.10
 * [new tag]             3.2.11                                                   -> 3.2.11
 * [new tag]             3.2.12                                                   -> 3.2.12
 * [new tag]             3.2.13                                                   -> 3.2.13
 * [new tag]             3.2.14                                                   -> 3.2.14
 * [new tag]             3.2.15                                                   -> 3.2.15
 * [new tag]             3.2.16                                                   -> 3.2.16
 * [new tag]             3.2.17                                                   -> 3.2.17
 * [new tag]             3.2.2                                                    -> 3.2.2
 * [new tag]             3.2.3                                                    -> 3.2.3
 * [new tag]             3.2.4                                                    -> 3.2.4
 * [new tag]             3.2.5                                                    -> 3.2.5
 * [new tag]             3.2.6                                                    -> 3.2.6
 * [new tag]             3.2.7                                                    -> 3.2.7
 * [new tag]             3.2.8                                                    -> 3.2.8
 * [new tag]             3.2.9                                                    -> 3.2.9
 * [new tag]             3.3.0                                                    -> 3.3.0
 * [new tag]             3.3.1                                                    -> 3.3.1
 * [new tag]             3.3.10                                                   -> 3.3.10
 * [new tag]             3.3.11                                                   -> 3.3.11
 * [new tag]             3.3.12                                                   -> 3.3.12
 * [new tag]             3.3.13                                                   -> 3.3.13
 * [new tag]             3.3.14                                                   -> 3.3.14
 * [new tag]             3.3.15                                                   -> 3.3.15
 * [new tag]             3.3.16                                                   -> 3.3.16
 * [new tag]             3.3.2                                                    -> 3.3.2
 * [new tag]             3.3.3                                                    -> 3.3.3
 * [new tag]             3.3.4                                                    -> 3.3.4
 * [new tag]             3.3.5                                                    -> 3.3.5
 * [new tag]             3.3.6                                                    -> 3.3.6
 * [new tag]             3.3.7                                                    -> 3.3.7
 * [new tag]             3.3.8                                                    -> 3.3.8
 * [new tag]             3.3.9                                                    -> 3.3.9
 * [new tag]             3.4.0                                                    -> 3.4.0
 * [new tag]             3.4.1                                                    -> 3.4.1
 * [new tag]             3.4.10                                                   -> 3.4.10
 * [new tag]             3.4.11                                                   -> 3.4.11
 * [new tag]             3.4.2                                                    -> 3.4.2
 * [new tag]             3.4.3                                                    -> 3.4.3
 * [new tag]             3.4.4                                                    -> 3.4.4
 * [new tag]             3.4.5                                                    -> 3.4.5
 * [new tag]             3.4.6                                                    -> 3.4.6
 * [new tag]             3.4.7                                                    -> 3.4.7
 * [new tag]             3.4.8                                                    -> 3.4.8
 * [new tag]             3.4.9                                                    -> 3.4.9
 * [new tag]             3.5.0                                                    -> 3.5.0
 * [new tag]             3.5.1                                                    -> 3.5.1
 * [new tag]             3.5.10                                                   -> 3.5.10
 * [new tag]             3.5.2                                                    -> 3.5.2
 * [new tag]             3.5.3                                                    -> 3.5.3
 * [new tag]             3.5.4                                                    -> 3.5.4
 * [new tag]             3.5.5                                                    -> 3.5.5
 * [new tag]             3.5.6                                                    -> 3.5.6
 * [new tag]             3.5.7                                                    -> 3.5.7
 * [new tag]             3.5.8                                                    -> 3.5.8
 * [new tag]             3.5.9                                                    -> 3.5.9
 * [new tag]             3.6.0                                                    -> 3.6.0
 * [new tag]             3.6.1                                                    -> 3.6.1
 * [new tag]             3.6.10                                                   -> 3.6.10
 * [new tag]             3.6.11                                                   -> 3.6.11
 * [new tag]             3.6.12                                                   -> 3.6.12
 * [new tag]             3.6.13                                                   -> 3.6.13
 * [new tag]             3.6.14                                                   -> 3.6.14
 * [new tag]             3.6.15                                                   -> 3.6.15
 * [new tag]             3.6.16                                                   -> 3.6.16
 * [new tag]             3.6.17                                                   -> 3.6.17
 * [new tag]             3.6.18                                                   -> 3.6.18
 * [new tag]             3.6.19                                                   -> 3.6.19
 * [new tag]             3.6.2                                                    -> 3.6.2
 * [new tag]             3.6.20                                                   -> 3.6.20
 * [new tag]             3.6.21                                                   -> 3.6.21
 * [new tag]             3.6.3                                                    -> 3.6.3
 * [new tag]             3.6.4                                                    -> 3.6.4
 * [new tag]             3.6.5                                                    -> 3.6.5
 * [new tag]             3.6.6                                                    -> 3.6.6
 * [new tag]             3.6.7                                                    -> 3.6.7
 * [new tag]             3.6.8                                                    -> 3.6.8
 * [new tag]             3.6.9                                                    -> 3.6.9
 * [new tag]             4.0.0                                                    -> 4.0.0
 * [new tag]             4.0.1                                                    -> 4.0.1
 * [new tag]             4.0.10                                                   -> 4.0.10
 * [new tag]             4.0.11                                                   -> 4.0.11
 * [new tag]             4.0.12                                                   -> 4.0.12
 * [new tag]             4.0.13                                                   -> 4.0.13
 * [new tag]             4.0.14                                                   -> 4.0.14
 * [new tag]             4.0.15                                                   -> 4.0.15
 * [new tag]             4.0.16                                                   -> 4.0.16
 * [new tag]             4.0.17                                                   -> 4.0.17
 * [new tag]             4.0.18                                                   -> 4.0.18
 * [new tag]             4.0.19                                                   -> 4.0.19
 * [new tag]             4.0.2                                                    -> 4.0.2
 * [new tag]             4.0.20                                                   -> 4.0.20
 * [new tag]             4.0.21                                                   -> 4.0.21
 * [new tag]             4.0.22                                                   -> 4.0.22
 * [new tag]             4.0.23                                                   -> 4.0.23
 * [new tag]             4.0.24                                                   -> 4.0.24
 * [new tag]             4.0.25                                                   -> 4.0.25
 * [new tag]             4.0.26                                                   -> 4.0.26
 * [new tag]             4.0.27                                                   -> 4.0.27
 * [new tag]             4.0.28                                                   -> 4.0.28
 * [new tag]             4.0.3                                                    -> 4.0.3
 * [new tag]             4.0.4                                                    -> 4.0.4
 * [new tag]             4.0.5                                                    -> 4.0.5
 * [new tag]             4.0.6                                                    -> 4.0.6
 * [new tag]             4.0.7                                                    -> 4.0.7
 * [new tag]             4.0.8                                                    -> 4.0.8
 * [new tag]             4.0.9                                                    -> 4.0.9
 * [new tag]             4.1.0                                                    -> 4.1.0
 * [new tag]             4.1.1                                                    -> 4.1.1
 * [new tag]             4.1.2                                                    -> 4.1.2
 * [new tag]             4.1.3                                                    -> 4.1.3
 * [new tag]             4.1.4                                                    -> 4.1.4
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (7/7), done.
remote: Total 13 (delta 7), reused 7 (delta 7), pack-reused 6
Unpacking objects: 100% (13/13), 2.77 KiB | 405.00 KiB/s, done.
From https://github.com/Homebrew/brew
 * [new tag]             4.0.29     -> 4.0.29
HEAD is now at dc42544c5 Merge pull request #15844 from EricFromCanada/cookbook-env-vars
Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/developer/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

developer@developers-Virtual-Machine ~ % eval "$(/opt/homebrew/bin/brew shellenv)"
developer@developers-Virtual-Machine ~ % brew install rbenv ruby-build postgresql@14
==> Fetching dependencies for rbenv: m4, autoconf, libyaml, pkg-config, readline and ruby-build
==> Fetching m4
==> Downloading https://ghcr.io/v2/homebrew/core/m4/manifests/1.4.19
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:11308abe8d607be35da9e88a1d789f191914bf043bca4fdde2b50a6cbf1713cc
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching autoconf
==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/manifests/2.71
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/autoconf/blobs/sha256:a3d366c98b0da7a0a4f352eef49af9d612ac7aea4ffe420d49ff12bd90007415
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching libyaml
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:11239e8f5066c6d0d0718208d4eab518da00c7289f33c9c76c0a09ba5c0417c9
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching pkg-config
==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/manifests/0.29.2_3
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:3ff612c5e44b945c8c0cc6df7d3edb407ca67cddad9c89f9ab99ced494b7a8c2
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching readline
==> Downloading https://ghcr.io/v2/homebrew/core/readline/manifests/8.2.1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:fba42a9bd6feaa8902ae4491ffdf177662e0a165a0d0ddef0988ad6ecf0f23dd
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching ruby-build
==> Downloading https://ghcr.io/v2/homebrew/core/ruby-build/manifests/20230717
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ruby-build/blobs/sha256:22802454be9a900c2d8ca2ed94ccf9fb443da505ae5b207c37cd4da15da98891
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching rbenv
==> Downloading https://ghcr.io/v2/homebrew/core/rbenv/manifests/1.2.0
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/rbenv/blobs/sha256:09bccc5974bd7b23f60a42c94bf7bc7d0e605cf4ef1f4068f63a1fe905bc5c74
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching dependencies for postgresql@14: icu4c, ca-certificates, openssl@3, krb5 and lz4
==> Fetching icu4c
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/73.2
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:953797d46546c570c4fab4e8b2395624ae90acd492f75b68ff99fbd115ccd748
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching ca-certificates
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2023-05-30
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:f664c0f185677a82689ada2a4e35c555e48885e6c2fb5e2dfcc82d9fb79cf870
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching openssl@3
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/manifests/3.1.2-1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:904a07d94bd731815d2db4c92abec9b90132cb9b0fb1c83a2906c364f9665b04
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching krb5
==> Downloading https://ghcr.io/v2/homebrew/core/krb5/manifests/1.21.1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/krb5/blobs/sha256:fa17fb49aa0363f2de649bd8b6ca370d3a97dee5e7299bc07e6b7b344d4ccc59
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching lz4
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/manifests/1.9.4
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/lz4/blobs/sha256:cd29e40287b0a2d665a647acbea5512e8db4c371687147aab5c60bf9059b2cca
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Fetching postgresql@14
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/14/manifests/14.8_2-1
######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/14/blobs/sha256:42360158c2699ffbaec32476a79c92346f64334ea4fc67a4087a18e4f8e3adee
#=#=-  #       #                                                                                                                                                                                                                                               ########################################################################################################################################################################################################################################################## 100.0%
==> Installing dependencies for rbenv: m4, autoconf, libyaml, pkg-config, readline and ruby-build
==> Installing rbenv dependency: m4
==> Pouring m4--1.4.19.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/m4/1.4.19: 13 files, 742.3KB
==> Installing rbenv dependency: autoconf
==> Pouring autoconf--2.71.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/autoconf/2.71: 71 files, 3.2MB
==> Installing rbenv dependency: libyaml
==> Pouring libyaml--0.2.5.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libyaml/0.2.5: 10 files, 351.3KB
==> Installing rbenv dependency: pkg-config
==> Pouring pkg-config--0.29.2_3.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pkg-config/0.29.2_3: 11 files, 676.2KB
==> Installing rbenv dependency: readline
==> Pouring readline--8.2.1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/readline/8.2.1: 50 files, 1.7MB
==> Installing rbenv dependency: ruby-build
==> Pouring ruby-build--20230717.all.bottle.tar.gz
🍺  /opt/homebrew/Cellar/ruby-build/20230717: 584 files, 306.2KB
==> Installing rbenv
==> Pouring rbenv--1.2.0.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/rbenv/1.2.0: 35 files, 125.2KB
==> Running `brew cleanup rbenv`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Running `brew cleanup ruby-build`...
==> Installing dependencies for postgresql@14: icu4c, ca-certificates, openssl@3, krb5 and lz4
==> Installing postgresql@14 dependency: icu4c
==> Pouring icu4c--73.2.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/icu4c/73.2: 268 files, 80.1MB
==> Installing postgresql@14 dependency: ca-certificates
==> Pouring ca-certificates--2023-05-30.arm64_ventura.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺  /opt/homebrew/Cellar/ca-certificates/2023-05-30: 3 files, 216.2KB
==> Installing postgresql@14 dependency: openssl@3
==> Pouring openssl@3--3.1.2.arm64_ventura.bottle.1.tar.gz
🍺  /opt/homebrew/Cellar/openssl@3/3.1.2: 6,495 files, 28.4MB
==> Installing postgresql@14 dependency: krb5
==> Pouring krb5--1.21.1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/krb5/1.21.1: 162 files, 5.6MB
==> Installing postgresql@14 dependency: lz4
==> Pouring lz4--1.9.4.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/lz4/1.9.4: 22 files, 680KB
==> Installing postgresql@14
==> Pouring postgresql@14--14.8_2.arm64_ventura.bottle.1.tar.gz
==> /opt/homebrew/Cellar/postgresql@14/14.8_2/bin/initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@14
==> Caveats
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@14
For more details, read:
  https://www.postgresql.org/docs/14/app-initdb.html

To start postgresql@14 now and restart at login:
  brew services start postgresql@14
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14
==> Summary
🍺  /opt/homebrew/Cellar/postgresql@14/14.8_2: 3,315 files, 45.3MB
==> Running `brew cleanup postgresql@14`...
==> Caveats
==> postgresql@14
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@14
For more details, read:
  https://www.postgresql.org/docs/14/app-initdb.html

To start postgresql@14 now and restart at login:
  brew services start postgresql@14
Or, if you don't want/need a background service you can just run:
  /opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14
developer@developers-Virtual-Machine ~ % brew services start postgresql@14
==> Tapping homebrew/services
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 2478, done.
remote: Counting objects: 100% (231/231), done.
remote: Compressing objects: 100% (118/118), done.
remote: Total 2478 (delta 141), reused 135 (delta 113), pack-reused 2247
Receiving objects: 100% (2478/2478), 686.21 KiB | 3.36 MiB/s, done.
Resolving deltas: 100% (1141/1141), done.
Tapped 1 command (45 files, 855.7KB).
==> Successfully started `postgresql@14` (label: homebrew.mxcl.postgresql@14)
developer@developers-Virtual-Machine ~ % eval "$(rbenv init - zsh)"
developer@developers-Virtual-Machine ~ % rbenv install 3.2.2; rbenv global 3.2.2
To follow progress, use 'tail -f /var/folders/0n/r940nk050hb0cb0k_gd6grmr0000gn/T/ruby-build.20230808113344.59841.log' or pass --verbose
Downloading openssl-3.1.1.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/b3aa61334233b852b63ddb048df181177c2c659eb9d4376008118f9c08d07674
Installing openssl-3.1.1...
Installed openssl-3.1.1 to /Users/developer/.rbenv/versions/3.2.2

Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
Installed ruby-3.2.2 to /Users/developer/.rbenv/versions/3.2.2


NOTE: to activate this Ruby version as the new default, run: rbenv global 3.2.2
developer@developers-Virtual-Machine ~ % ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
developer@developers-Virtual-Machine ~ % mkdir testapp && cd testapp
developer@developers-Virtual-Machine testapp % gem install rails
Fetching zeitwerk-2.6.11.gem
Fetching thor-1.2.2.gem
Fetching method_source-1.0.0.gem
Fetching concurrent-ruby-1.2.2.gem
Fetching tzinfo-2.0.6.gem
Fetching i18n-1.14.1.gem
Fetching minitest-5.19.0.gem
Fetching activesupport-7.0.6.gem
Fetching nokogiri-1.15.3-arm64-darwin.gem
Fetching crass-1.0.6.gem
Fetching loofah-2.21.3.gem
Fetching rails-html-sanitizer-1.6.0.gem
Fetching rails-dom-testing-2.2.0.gem
Fetching rack-2.2.8.gem
Fetching rack-test-2.1.0.gem
Fetching erubi-1.12.0.gem
Fetching builder-3.2.4.gem
Fetching actionview-7.0.6.gem
Fetching actionpack-7.0.6.gem
Fetching railties-7.0.6.gem
Fetching mini_mime-1.1.5.gem
Fetching marcel-1.0.2.gem
Fetching activemodel-7.0.6.gem
Fetching activerecord-7.0.6.gem
Fetching globalid-1.1.0.gem
Fetching activejob-7.0.6.gem
Fetching activestorage-7.0.6.gem
Fetching actiontext-7.0.6.gem
Fetching mail-2.8.1.gem
Fetching actionmailer-7.0.6.gem
Fetching actionmailbox-7.0.6.gem
Fetching websocket-extensions-0.1.5.gem
Fetching rails-7.0.6.gem
Fetching websocket-driver-0.7.6.gem
Fetching nio4r-2.5.9.gem
Fetching actioncable-7.0.6.gem
Successfully installed zeitwerk-2.6.11
Successfully installed thor-1.2.2
Successfully installed method_source-1.0.0
Successfully installed concurrent-ruby-1.2.2
Successfully installed tzinfo-2.0.6
Successfully installed minitest-5.19.0
Successfully installed i18n-1.14.1
Successfully installed activesupport-7.0.6
Successfully installed nokogiri-1.15.3-arm64-darwin
Successfully installed crass-1.0.6
Successfully installed loofah-2.21.3
Successfully installed rails-html-sanitizer-1.6.0
Successfully installed rails-dom-testing-2.2.0
Successfully installed rack-2.2.8
Successfully installed rack-test-2.1.0
Successfully installed erubi-1.12.0
Successfully installed builder-3.2.4
Successfully installed actionview-7.0.6
Successfully installed actionpack-7.0.6
Successfully installed railties-7.0.6
Successfully installed mini_mime-1.1.5
Successfully installed marcel-1.0.2
Successfully installed activemodel-7.0.6
Successfully installed activerecord-7.0.6
Successfully installed globalid-1.1.0
Successfully installed activejob-7.0.6
Successfully installed activestorage-7.0.6
Successfully installed actiontext-7.0.6
Successfully installed mail-2.8.1
Successfully installed actionmailer-7.0.6
Successfully installed actionmailbox-7.0.6
Successfully installed websocket-extensions-0.1.5
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.6
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.9
Successfully installed actioncable-7.0.6
Successfully installed rails-7.0.6
Parsing documentation for zeitwerk-2.6.11
Installing ri documentation for zeitwerk-2.6.11
Parsing documentation for thor-1.2.2
Installing ri documentation for thor-1.2.2
Parsing documentation for method_source-1.0.0
Installing ri documentation for method_source-1.0.0
Parsing documentation for concurrent-ruby-1.2.2
Installing ri documentation for concurrent-ruby-1.2.2
Parsing documentation for tzinfo-2.0.6
Installing ri documentation for tzinfo-2.0.6
Parsing documentation for minitest-5.19.0
Couldn't find file to include 'README.rdoc' from lib/minitest.rb
Installing ri documentation for minitest-5.19.0
Parsing documentation for i18n-1.14.1
Installing ri documentation for i18n-1.14.1
Parsing documentation for activesupport-7.0.6
Installing ri documentation for activesupport-7.0.6
Parsing documentation for nokogiri-1.15.3-arm64-darwin
Installing ri documentation for nokogiri-1.15.3-arm64-darwin
Parsing documentation for crass-1.0.6
Installing ri documentation for crass-1.0.6
Parsing documentation for loofah-2.21.3
Installing ri documentation for loofah-2.21.3
Parsing documentation for rails-html-sanitizer-1.6.0
Installing ri documentation for rails-html-sanitizer-1.6.0
Parsing documentation for rails-dom-testing-2.2.0
Installing ri documentation for rails-dom-testing-2.2.0
Parsing documentation for rack-2.2.8
Installing ri documentation for rack-2.2.8
Parsing documentation for rack-test-2.1.0
Installing ri documentation for rack-test-2.1.0
Parsing documentation for erubi-1.12.0
Installing ri documentation for erubi-1.12.0
Parsing documentation for builder-3.2.4
Installing ri documentation for builder-3.2.4
Parsing documentation for actionview-7.0.6
Installing ri documentation for actionview-7.0.6
Parsing documentation for actionpack-7.0.6
Installing ri documentation for actionpack-7.0.6
Parsing documentation for railties-7.0.6
Installing ri documentation for railties-7.0.6
Parsing documentation for mini_mime-1.1.5
Installing ri documentation for mini_mime-1.1.5
Parsing documentation for marcel-1.0.2
Installing ri documentation for marcel-1.0.2
Parsing documentation for activemodel-7.0.6
Installing ri documentation for activemodel-7.0.6
Parsing documentation for activerecord-7.0.6
Installing ri documentation for activerecord-7.0.6
Parsing documentation for globalid-1.1.0
Installing ri documentation for globalid-1.1.0
Parsing documentation for activejob-7.0.6
Installing ri documentation for activejob-7.0.6
Parsing documentation for activestorage-7.0.6
Installing ri documentation for activestorage-7.0.6
Parsing documentation for actiontext-7.0.6
Installing ri documentation for actiontext-7.0.6
Parsing documentation for mail-2.8.1
Installing ri documentation for mail-2.8.1
Parsing documentation for actionmailer-7.0.6
Installing ri documentation for actionmailer-7.0.6
Parsing documentation for actionmailbox-7.0.6
Installing ri documentation for actionmailbox-7.0.6
Parsing documentation for websocket-extensions-0.1.5
Installing ri documentation for websocket-extensions-0.1.5
Parsing documentation for websocket-driver-0.7.6
Installing ri documentation for websocket-driver-0.7.6
Parsing documentation for nio4r-2.5.9
Installing ri documentation for nio4r-2.5.9
Parsing documentation for actioncable-7.0.6
Installing ri documentation for actioncable-7.0.6
Parsing documentation for rails-7.0.6
Installing ri documentation for rails-7.0.6
Done installing documentation for zeitwerk, thor, method_source, concurrent-ruby, tzinfo, minitest, i18n, activesupport, nokogiri, crass, loofah, rails-html-sanitizer, rails-dom-testing, rack, rack-test, erubi, builder, actionview, actionpack, railties, mini_mime, marcel, activemodel, activerecord, globalid, activejob, activestorage, actiontext, mail, actionmailer, actionmailbox, websocket-extensions, websocket-driver, nio4r, actioncable, rails after 15 seconds
36 gems installed

A new release of RubyGems is available: 3.4.10 → 3.4.18!
Run `gem update --system 3.4.18` to update your installation.
developer@developers-Virtual-Machine testapp % rails new -d postgresql .
       exist
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in /Users/developer/testapp/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_0.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/.keep
      create  tmp/pids
      create  tmp/pids/.keep
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  vendor/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/channels/application_cable/connection_test.rb
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_0.rb
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.0.6
Using minitest 5.19.0
Fetching racc 1.7.1
Using concurrent-ruby 1.2.2
Using crass 1.0.6
Using builder 3.2.4
Using erubi 1.12.0
Using rack 2.2.8
Using nio4r 2.5.9
Using marcel 1.0.2
Using mini_mime 1.1.5
Using date 3.3.3
Fetching timeout 0.4.0
Fetching public_suffix 5.0.3
Using websocket-extensions 0.1.5
Fetching bindex 0.8.1
Installing timeout 0.4.0
Installing bindex 0.8.1 with native extensions
Installing racc 1.7.1 with native extensions
Installing public_suffix 5.0.3
Fetching msgpack 1.7.2
Installing msgpack 1.7.2 with native extensions
Using bundler 2.4.10
Using matrix 0.4.2
Fetching regexp_parser 2.8.1
Installing regexp_parser 2.8.1
Using io-console 0.6.0
Using method_source 1.0.0
Using thor 1.2.2
Using zeitwerk 2.6.11
Fetching pg 1.5.3
Installing pg 1.5.3 with native extensions
Fetching rexml 3.2.6
Installing rexml 3.2.6
Fetching rubyzip 2.3.2
Installing rubyzip 2.3.2
Fetching websocket 1.2.9
Installing websocket 1.2.9
Using i18n 1.14.1
Using tzinfo 2.0.6
Fetching puma 5.6.6
Installing puma 5.6.6 with native extensions
Using rack-test 2.1.0
Using websocket-driver 0.7.6
Fetching sprockets 4.2.0
Installing sprockets 4.2.0
Using net-protocol 0.2.1
Fetching addressable 2.8.5
Installing addressable 2.8.5
Fetching reline 0.3.7
Installing reline 0.3.7
Using activesupport 7.0.6
Fetching selenium-webdriver 4.10.0
Installing selenium-webdriver 4.10.0
Using nokogiri 1.15.3 (arm64-darwin)
Fetching net-imap 0.3.7
Installing net-imap 0.3.7
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using globalid 1.1.0
Using activemodel 7.0.6
Fetching irb 1.7.4
Installing irb 1.7.4
Using rails-dom-testing 2.2.0
Using loofah 2.21.3
Fetching xpath 3.2.0
Installing xpath 3.2.0
Fetching webdrivers 5.3.1
Installing webdrivers 5.3.1
Using activejob 7.0.6
Using activerecord 7.0.6
Using mail 2.8.1
Fetching debug 1.8.0
Installing debug 1.8.0 with native extensions
Using rails-html-sanitizer 1.6.0
Fetching capybara 3.39.2
Installing capybara 3.39.2
Using actionview 7.0.6
Using actionpack 7.0.6
Fetching jbuilder 2.11.5
Installing jbuilder 2.11.5
Using actioncable 7.0.6
Using activestorage 7.0.6
Using actionmailer 7.0.6
Using railties 7.0.6
Fetching sprockets-rails 3.4.2
Installing sprockets-rails 3.4.2
Using actionmailbox 7.0.6
Using actiontext 7.0.6
Fetching importmap-rails 1.2.1
Installing importmap-rails 1.2.1
Fetching stimulus-rails 1.2.2
Installing stimulus-rails 1.2.2
Fetching turbo-rails 1.4.0
Fetching web-console 4.2.0
Using rails 7.0.6
Fetching bootsnap 1.16.0
Installing turbo-rails 1.4.0
Installing bootsnap 1.16.0 with native extensions
Installing web-console 4.2.0
Bundle complete! 15 Gemfile dependencies, 72 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
       rails  importmap:install
Add Importmap include tags in application layout
      insert  app/views/layouts/application.html.erb
Create application.js module as entrypoint
      create  app/javascript/application.js
Use vendor/javascript for downloaded pins
      create  vendor/javascript
      create  vendor/javascript/.keep
Ensure JavaScript files are in the Sprocket manifest
      append  app/assets/config/manifest.js
Configure importmap paths in config/importmap.rb
      create  config/importmap.rb
Copying binstub
      create  bin/importmap
       rails  turbo:install stimulus:install
Import Turbo
      append  app/javascript/application.js
Pin Turbo
      append  config/importmap.rb
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
Create controllers directory
      create  app/javascript/controllers
      create  app/javascript/controllers/index.js
      create  app/javascript/controllers/application.js
      create  app/javascript/controllers/hello_controller.js
Import Stimulus controllers
      append  app/javascript/application.js
Pin Stimulus
Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true"
      append  config/importmap.rb
Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
      append  config/importmap.rb
Pin all controllers
Appending: pin_all_from "app/javascript/controllers", under: "controllers"
      append  config/importmap.rb
developer@developers-Virtual-Machine testapp % cat <<-EOF > config/database.yml
  default: &default
    adapter: postgresql
    host: localhost
    pool: 5
    timeout: 5000

  development:
    <<: *default
    database: testapp_development

  test:
    <<: *default
    database: testapp_test
EOF
developer@developers-Virtual-Machine testapp % rails g model Product name:string
      invoke  active_record
      create    db/migrate/20230808174206_create_products.rb
      create    app/models/product.rb
      invoke    test_unit
      create      test/models/product_test.rb
      create      test/fixtures/products.yml
developer@developers-Virtual-Machine testapp % rake db:setup; rake db:migrate
Created database 'testapp_development'
Created database 'testapp_test'
/Users/developer/testapp/db/schema.rb doesn't exist yet. Run `bin/rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/developer/testapp/config/application.rb to limit the frameworks that will be loaded.
== 20230808174206 CreateProducts: migrating ===================================
-- create_table(:products)
   -> 0.0129s
== 20230808174206 CreateProducts: migrated (0.0130s) ==========================
developer@developers-Virtual-Machine testapp % cat <<-EOF > test/models/product_test.rb
  require "test_helper"

  class ProductTest < ActiveSupport::TestCase
    test "the truth" do
      assert_equal Product.count, 2
    end
  end
EOF
developer@developers-Virtual-Machine testapp % rake test
Running 1 tests in a single process (parallelization threshold is 50)
Run options: --seed 49513

# Running:

.

Finished in 0.027316s, 36.6086 runs/s, 36.6086 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
developer@developers-Virtual-Machine testapp % sed -i '' 's/# gem "spring"/gem "spring"/' Gemfile; bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using builder 3.2.4
Using crass 1.0.6
Using erubi 1.12.0
Using nio4r 2.5.9
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.5
Using date 3.3.3
Using timeout 0.4.0
Using public_suffix 5.0.3
Using bindex 0.8.1
Using msgpack 1.7.2
Using bundler 2.4.10
Using matrix 0.4.2
Using regexp_parser 2.8.1
Using io-console 0.6.0
Using racc 1.7.1
Using thor 1.2.2
Using zeitwerk 2.6.11
Using rack 2.2.8
Using minitest 5.19.0
Using rubyzip 2.3.2
Using pg 1.5.3
Using rexml 3.2.6
Fetching spring 4.1.1
Using method_source 1.0.0
Using tzinfo 2.0.6
Using i18n 1.14.1
Using websocket-driver 0.7.6
Using net-protocol 0.2.1
Using addressable 2.8.5
Using bootsnap 1.16.0
Using websocket 1.2.9
Using puma 5.6.6
Using nokogiri 1.15.3 (arm64-darwin)
Using reline 0.3.7
Using activesupport 7.0.6
Using rack-test 2.1.0
Using sprockets 4.2.0
Using net-imap 0.3.7
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using selenium-webdriver 4.10.0
Using rails-dom-testing 2.2.0
Using globalid 1.1.0
Using activemodel 7.0.6
Using irb 1.7.4
Using xpath 3.2.0
Using activejob 7.0.6
Using loofah 2.21.3
Using mail 2.8.1
Using activerecord 7.0.6
Using debug 1.8.0
Using rails-html-sanitizer 1.6.0
Using webdrivers 5.3.1
Using capybara 3.39.2
Using actionview 7.0.6
Using jbuilder 2.11.5
Using actionpack 7.0.6
Using actioncable 7.0.6
Using railties 7.0.6
Using actionmailer 7.0.6
Using sprockets-rails 3.4.2
Using stimulus-rails 1.2.2
Using turbo-rails 1.4.0
Using web-console 4.2.0
Using activestorage 7.0.6
Using importmap-rails 1.2.1
Using actiontext 7.0.6
Using actionmailbox 7.0.6
Using rails 7.0.6
Installing spring 4.1.1
Bundle complete! 16 Gemfile dependencies, 73 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
developer@developers-Virtual-Machine testapp % sed -i '' 's/config.cache_classes = true/config.cache_classes = false/' config/environments/test.rb
developer@developers-Virtual-Machine testapp % bundle exec spring binstub --all; rbenv rehash
* bin/rake: Spring inserted
* bin/rails: Spring inserted
developer@developers-Virtual-Machine testapp % bin/rake test
Running via Spring preloader in process 17234
Running via Spring preloader in process 17236
objc[17236]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[17236]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

I just ran into this, and this comment pointed me to this fix which worked for me:

just export PGGSSENCMODE="disable" until this is fixed :)

I added export PGGSSENCMODE="disable" to my ~/.zshrc

I was also able to work around this by doing something similar. I added PGGSSENCMODE=disable to my .env.local.developement and .env.local.test files, since I use Dotenv for this project.

just export PGGSSENCMODE="disable" until this is fixed :)

What I'm not able to figure out is: which project or library should own this fix?

@jcarlson I think at the minimum it's safe to say that this issue is not a Rails issue, because there is nothing in the Rails codebase that can be changed to solve this.

The fix will need to be in someone's C code. It has to do with behavior that is outside of "regular" Ruby execution. So I think this has to be hashed out between ruby-pg and the dependencies that gem brings in, including krb5.

Unfortunately, it seems like it only takes one library to allocate a string the wrong way post-fork to trigger this issue, so we are probably looking at a game of Whac-a-Mole for the time being.

@jcarlson I never use Homebrew on any of my machines. Next, I'm to use the following database.yml because it plays nice with Docker and Docker Compose:

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  host: <%= ENV.fetch("POSTGRES_HOST") { 'localhost' } %>
  username: <%= ENV.fetch("POSTGRES_USER") { 'postgres' } %>
  password: <%= ENV.fetch("POSTGRES_PASSWORD") { 'password' } %>

development:
  <<: *default
  database: testapp_development

test:
  <<: *default
  database: testapp_test

production:
  <<: *default
  database: testapp_production

Next, were you able to reproduce the same issue with spring disabled?

@nertzy Whac-a-mole for sure. Agreed, it's probably not a Rails issue to fix, but it could be a Rails (or Spring) issue to provide an automatic mitigation. I'm not sure yet how one might detect the need for such a mitigation, but I'll give it some thought.

@conradwt Everything works fine without spring. You'll see toward the end of my "Console Output" above that the test suite passes, then I enable spring and re-run the tests, and that's when it fails.

So an automatic mitigation strategy I suppose might look like: "if you are using spring, and you are using postgres, and your pg gem was compiled against Postgres 12+ binaries with GSSAPI enabled, and your Posgres binaries were themselves linked against Homebrew's krb5 1.21+ package, then automatically add PGGSSENCMODE=disable to the environment"? 😬

I encountered this issue while starting my Rails server after updating my PostgreSQL version to 15 using Homebrew (precisely version 15.4). As a result, I needed to redo a few steps in my app installation and also update the pg gem. Additionally, I used the following command:

brew link postgresql@15 --force

This was necessary to ensure that my application works seamlessly with this specific PostgreSQL version.

I'm currently working with the following environment:

  • Rails 6.1.3.1
  • Ruby 3.1.2
  • macOS 13.4.1
  • No Spring
  • No Docker

I resolved the issue by adding export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES to my .bash_profile. This fix allowed me to start my server without any problems. However, I'm curious about the purpose of OBJC_DISABLE_INITIALIZE_FORK_SAFETY, as mentioned by @jcarlson here:

Can anyone point me to more information about what OBJC_DISABLE_INITIALIZE_FORK_SAFETY does? Anything named "something something disable safety" sounds like it ought not to be disabled...

I don't really like to apply this solution without understanding what it does. Either way, that was already said so now I want to point a different problem that I have.

Occasionally, after making significant changes to my app, I test it by loading everything using config.eager_load = true in my development.rb file. But now I'm experiencing a very dramatic server crash. The output below is a snippet of the crash report:

13a134000-13a140000 r-x /Users/vosavos/.rvm/gems/ruby-3.1.2@hogaru_rails_6/gems/nio4r-2.5.8/lib/nio4r_ext.bundle
13a140000-13a144000 r-- /Users/vosavos/.rvm/gems/ruby-3.1.2@hogaru_rails_6/gems/nio4r-2.5.8/lib/nio4r_ext.bundle
13a144000-13a148000 rw- /Users/vosavos/.rvm/gems/ruby-3.1.2@hogaru_rails_6/gems/nio4r-2.5.8/lib/nio4r_ext.bundle
13a148000-13a150000 r-- /Users/vosavos/.rvm/gems/ruby-3.1.2@hogaru_rails_6/gems/nio4r-2.5.8/lib/nio4r_ext.bundle
13a154000-13a158000 rw-
13a15c000-13a160000 rw-
13a164000-13a168000 rw-

- [IMPORTANT]
- Don't forget to include the Crash Report log file under
- DiagnosticReports directory in bug reports.

I guess this issue is related to the nio4r gem, though I'm uncertain if it's connected to the topic under discussion. Any insights on this matter would be greatly appreciated.

Thank you, and my apologies if my communication isn't entirely clear. This is my first time posting in an issue, and English is not my primary language! 😅

@byVerbel If you think that the issue could be with the nio4r gem, I highly recommend filing another issue with that team. Their repository can be found here. Finally, if you can update your comment by removing the nio4r bits, it would be much appreciated.

I'm pretty sure the issue isn't with the nio4r gem, I assume that is just one of many things showing in the backtrace printed when Ruby crash – what I think is happening for @byVerbel is that is Puma launched in cluster-mode, forks, and triggers the bug (on the first request for me). I have the same thing happening for me (on one of my Mac computers), the start of the crash looks like this (the full backtrace is huge, thousands of lines)

08:56:42 web.1  | [31054] * Listening on http://0.0.0.0:8080
08:56:42 web.1  | [31054] * Listening on ssl://0.0.0.0:7080?&verify_mode=none
08:56:42 web.1  | [31054] Use Ctrl-C to stop
08:56:42 web.1  | [31054] - Worker 0 (PID: 31062) booted in 0.0s, phase: 0
08:56:42 web.1  | [31054] - Worker 1 (PID: 31063) booted in 0.0s, phase: 0
08:56:47 web.1  | /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/pg-1.5.3/lib/pg/connection.rb:690: [BUG] Segmentation fault at 0x0000000103f70aba
08:56:47 web.1  | ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin21]
08:56:47 web.1  |
08:56:47 web.1  | -- Crash Report log information --------------------------------------------
08:56:47 web.1  |    See Crash Report log file in one of the following locations:
08:56:47 web.1  |      * ~/Library/Logs/DiagnosticReports
08:56:47 web.1  |      * /Library/Logs/DiagnosticReports
08:56:47 web.1  |    for more details.
08:56:47 web.1  | Don't forget to include the above Crash Report log file in bug reports.
08:56:47 web.1  |
08:56:47 web.1  | -- Control frame information -----------------------------------------------
08:56:47 web.1  | c:0082 p:---- s:0524 e:000523 CFUNC  :connect_poll
08:56:47 web.1  | c:0081 p:0358 s:0520 e:000519 METHOD /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/pg-1.5.3/lib/pg/connection.rb:690
08:56:47 web.1  | c:0080 p:0265 s:0507 e:000506 METHOD /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/pg-1.5.3/lib/pg/connection.rb:824
08:56:47 web.1  | c:0079 p:0007 s:0496 e:000495 METHOD /Users/dentarg/.arm64_rubies/3.2.2/lib/ruby/gems/3.2.0/gems/pg-1.5.3/lib/pg/connection.rb:759

@byVerbel with regards to setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES, you can instead set PGGSSENCMODE=disable, and this also resolves the issue.

I can explain this setting a bit more. It disables GSS API authenticaiton between the pg gem (client) and Postgres Server. It is this functionality which is causing issues when your pggem native extensions are built against a Postgres server edition with GSS API support enabled which itself is linked against a recent version of Kerberos provided by Homebrew.

For context this is the Ruby issue for this, it would be fixed in more recent versions of Ruby, so I suggest upgrading Ruby if possible

I am running Ruby 3.2.2 and still getting this issue when running locally with puma on Rails 6.1 with postgres.

The OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES fix works for me on both Intel mac and M2 mac.

Also confirming fix by @jcarlson PGGSSENCMODE=disable works.

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

It works for me!

This is not a Rails issue and there are plenty of solutions to the problem that work (for me too), so I'm going to lock this.

If you do run into a problem with Rails, please file a ticket or ask on discuss.

Thanks!

Nobody should have to hunt for this. It should be fixed fully and for all. Doesn't matter where the problem is, let's keep this open until resolved.

This error is mostly bad code spawning threads before forking. Do you have a way to reproduce the issue? Instead of setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY we should be fixing the problem.

I pretty much agree with conclusion in https://blog.phusion.nl/2017/10/13/why-ruby-app-servers-break-on-macos-high-sierra-and-what-can-be-done-about-it/

Towards a real solution: cooperation from gem authors required

The workaround does not really solve the problem. The fundamental problem -- that forking is at odds with multithreading -- is still there, even before High Sierra, and even on Linux. The workaround merely disables a safety check, and users are just lucky that they don't run into bad situations most of the time.

To guarantee that forking is safe, the application must not be running any threads at the point of fork (or the other threads must only be executing async-signal-safe code). MRI can guarantee this about its own code to some degree, but third party native libraries may spawn their own threads. So any gems that the user pulls in must not spawn threads until the app server has forked.

I propose the following to authors of gems with native extensions: all such gems should ensure that no threads are spawned during require time. Instead, they should ensure that threads are only spawned after calling an explicit initialization method. That way, users can configure the app server in such a way that threads are only initialized after forking, while preserving the advantages of copy-on-write preforking.

So first we need to identify which code is causing this error to happen so we fix it. Enabling the workaround will open users to have catastrophic failures they likely will not know how to recover from

If PGGSSENCMODE=disable fixes your problem, this problem occurs when:

  1. You have installed krb5 library >= 1.21 due to krb5/krb5#1221.
  2. The PostgreSQL server supports GSSAPI for Kerberos authentication. By default, Homebrew compiles PostgreSQL with this enabled, while the asdf-postgres plugin does NOT.
  3. By default, the PostgreSQL client defaults to gssencmode=prefer, which means the client will attempt to use GSSAPI.
  4. Your Web application server connects to the database for the first time in a fork.

For example, I can reproduce this if I link the pg gem against the Homebrew PostgreSQL libraries, run the Homebrew PostgreSQL server, and launch this client (as discussed in ged/ruby-pg#311):

#!/usr/bin/env ruby
require 'pg'

PG.connect(:host => 'localhost', :user => 'username', :dbname => 'template1')

Process.fork do
  PG.connect(:host => 'localhost', :user => 'username', :dbname => 'template1')
end

You can see the details in the backtrace from the crash report:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x180dfa0dc __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x180e31cc0 pthread_kill + 288
2   libsystem_c.dylib             	       0x180d3da40 abort + 180
3   libruby.3.2.dylib             	       0x10387e0b4 die + 12
4   libruby.3.2.dylib             	       0x10387e274 rb_bug_for_fatal_signal + 448
5   libruby.3.2.dylib             	       0x1039ac05c sigsegv + 96
6   libsystem_platform.dylib      	       0x180e61a24 _sigtramp + 56
7   libsystem_trace.dylib         	       0x180b90220 _os_log_preferences_refresh + 40
8   libsystem_trace.dylib         	       0x180b90c9c os_log_type_enabled + 712
9   libxpc.dylib                  	       0x180b503a0 _xpc_connection_activate_if_needed + 160
10  libxpc.dylib                  	       0x180b52e74 xpc_connection_resume + 96
11  libkrb5.3.3.dylib             	       0x1066809f0 get_primary_name + 152
12  libkrb5.3.3.dylib             	       0x1066804dc api_macos_ptcursor_next + 240
13  libkrb5.3.3.dylib             	       0x10667d788 krb5_cccol_cursor_next + 76
14  libkrb5.3.3.dylib             	       0x10667da70 krb5_cccol_have_content + 92
15  libgssapi_krb5.2.2.dylib      	       0x10643d894 acquire_cred_context + 1664
16  libgssapi_krb5.2.2.dylib      	       0x10643d19c acquire_cred_from + 688
17  libgssapi_krb5.2.2.dylib      	       0x10642f180 gss_add_cred_from + 624
18  libgssapi_krb5.2.2.dylib      	       0x10642edc8 gss_acquire_cred_from + 400
19  libgssapi_krb5.2.2.dylib      	       0x10642ec2c gss_acquire_cred + 36
20  libpq.5.13.dylib              	       0x103777cf8 pg_GSS_have_cred_cache + 60
21  libpq.5.13.dylib              	       0x103766dd4 PQconnectPoll + 4400
22  pg_ext.bundle                 	       0x1036c8900 gvl_PQconnectPoll_skeleton + 24
23  libruby.3.2.dylib             	       0x1039e6f38 rb_nogvl + 268
24  pg_ext.bundle                 	       0x1036c88d8 gvl_PQconnectPoll + 44
25  pg_ext.bundle                 	       0x1036cece4 pgconn_connect_poll + 48
26  libruby.3.2.dylib             	       0x103a36b18 vm_call_cfunc_with_frame + 232
27  libruby.3.2.dylib             	       0x103a37380 vm_call_symbol + 572
28  libruby.3.2.dylib             	       0x103a38e88 vm_sendish + 1160
29  libruby.3.2.dylib             	       0x103a1c528 vm_exec_core + 8064
30  libruby.3.2.dylib             	       0x103a2e0bc rb_vm_exec + 2164
31  libruby.3.2.dylib             	       0x103a3d4e0 invoke_block_from_c_bh + 932
32  libruby.3.2.dylib             	       0x103a27aec rb_yield + 180
33  libruby.3.2.dylib             	       0x10388a570 rb_protect + 356
34  libruby.3.2.dylib             	       0x103959ab4 rb_f_fork + 144
  1. krb5 calls get_primary_node.
  2. get_primary_node calls xpc_connection_resume, which eventually attempts to call _os_log_preferences_refresh.
  3. That attempts to allocate NSCFConstantString, which triggers the seg fault.

As described in puma/puma#1421, a possible workaround may be to load the Foundation framework before the fork. The following seems to help (though for some reason require 'fiddle' alone seems to suffice for me):

#!/usr/bin/env ruby
require 'pg'

PG.connect(:host => 'localhost', :user => 'username', :dbname => 'test_db')

if /darwin/ =~ RUBY_PLATFORM
  require 'fiddle'
  Fiddle.dlopen('/System/Library/Frameworks/Foundation.framework/Foundation')
end

Process.fork do
  PG.connect(:host => 'localhost', :user => 'username', :dbname => 'test_db')
end

UPDATE: I recall that Ruby added a patch to handle this in https://bugs.ruby-lang.org/issues/14009. I think the change from linking Foundation to CoreFoundation in https://bugs.ruby-lang.org/issues/17730 might have caused this patch to stop working in Ruby 3.1 and up.

Note that there may be many other reasons for this [NCSFConstantString initialize] seg fault. For example, we saw this when the Elasticsearch gem were used with Typhoeus, which uses libcurl. See curl/curl#11252 and elastic/elasticsearch-ruby#2244 for more details.

The grpc gem also has this issue: grpc/grpc#33281. I tried to fix this upstream in grpc/grpc#33400, but I ended up working around this issue with this ugly fix: https://gitlab.com/gitlab-org/gitlab/-/blob/master/config/initializers/macos.rb.

wow! great comment @stanhu!

If I got this right, there are many reasons why this warning can happen and it can indeed cause seg fault error. The ideal would be to fix the issues upstream in each of those projects.

@byroot you did a lot of fork safety changes lately, do you think it is safe for us to disable this warning on Mac OS with OBJC_DISABLE_INITIALIZE_FORK_SAFETY?

do you think it is safe for us to disable this warning on Mac OS with OBJC_DISABLE_INITIALIZE_FORK_SAFETY?

I'm afraid I don't know enough about the ObjectiveC runtime to have a strong opinion about this.

From what I understood of @stanhu 's comment, this happens after calling some macOS APIs that spawned a thread or did some other things that cause the process to no longer be guaranteed to be fork safe.

In most cases it doesn't mean bad things will always happen if you ignore this safety, just that there is a non-zero chance. The effects can range from a process crash to some function deadlocking on a mutex. So something that would be terrible in production, but just very annoying in development, and I suppose we can assume macOS == development.

So I suppose it's "safe" as in this is extremely unlikely to crash any kind of production adjacent system.

What would worry me more would be that by turning this off we'll make this issue more rare for users, but also more pervasive as it be less likely to be reported and fixed upstream (be it Ruby of various gems).

Reading upstream issues more in details, if we want to include a fix or workaround in Rails proper, I think embeding the fiddle workaround in Rails would be better than setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY, as it effectively fixes the root cause, rather than disable the safety and pray it won't break.

If I got this right, there are many reasons why this warning can happen and it can indeed cause seg fault error. The ideal would be to fix the issues upstream in each of those projects.

@rafaelfranca I think so, though that would mean every gem would need to be aware that they need to run any thread-unsafe macOS API calls at require time before the fork. In many cases, such as in the case of pg, it's sufficient just to load the Foundation framework. However, in the grpc case, it's not enough; you have to invoke macOS CFTimeZoneCopyDefault once. I fixed the curl issue in curl/curl#11254 by moving the call to SCDynamicStoreCopyProxies to the global init function.

That's where the onus of the problem become tricky: these macOS calls may be in some other library, and there may be some resistance to make the necessary changes. For example, the pg gem itself doesn't make any native macOS calls, but the underlying krb5 library does. The krb5 library would then need to expose some initialization API, but would the library owners agree with the need? Or should pg work around the issue?

The Ruby interpreter attempted to address the loading of Framework in https://bugs.ruby-lang.org/issues/14009. However, I think Ruby 3.1 and up caused this workaround for pg to stop working since https://bugs.ruby-lang.org/issues/17730 switched from loading the Foundation framework to CoreFoundation due to the high number of dependencies the former required. I noticed that people on this issue have reported seg faults even on Ruby 2.7, so perhaps the fix is not complete.

With the Ruby interpreter change, I think we're left to wonder: who's job is it to fix this? Should the Ruby interpreter revert back to loading Framework? Or should the fiddle workaround be implemented in Rails, Puma, or even pg?

With the Ruby interpreter change, I think we're left to wonder: who's job is it to fix this?

Definitely is Ruby's job. If not initializing all this means children are essentially broken, then it's a bug in Ruby's fork on macOS. It's also much easier for Ruby to initialize these libraries just in time when you call fork.

But of course fixing this in Ruby will certainly take more time, so in the meantime we could ship your workaround in Rails, we could even invoke it from Process._fork (Ruby 3.1+) so it only impact you if you actually have a forking setup in development on macOS.

I'd be against integrating the workaound for grpc though, it's much more logic, and the grpc gem shouldn't be touched with a ten foot pole anyway.

Just throwing this out there: sounds like Python have more or less given up on fork after these issues surfaced in 2018? python/cpython#84559, https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-alive-threads/33555

sounds like Python have more or less given up on fork

Not exactly. I only skimmed the threads you linked, but it's on fork after (native) threads have been spawned, which isn't anything new, and isn't really related to the issue at hand.

In my note above, I said:

I noticed that people on this issue have reported seg faults even on Ruby 2.7, so perhaps the fix is not complete.

I have an even simpler reproduction that generates a similar but different seg fault:

#!/usr/bin/env ruby
require 'pg'

Process.fork do
  PG.connect(:host => 'localhost', :user => 'username', :dbname => 'template1')
end

Unlike my previous example, this one is consistently repeatable since the first connection attempt happens inside the fork. The backtrace is quite different, though, and calling Fiddle.dlopen to load various frameworks doesn't make it go away. This might explain why the current Ruby interpreter workaround to load the framework doesn't always work:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x189d0a72c __abort_with_payload + 8
1   libsystem_kernel.dylib        	       0x189d2ff88 abort_with_payload_wrapper_internal + 104
2   libsystem_kernel.dylib        	       0x189d2ff20 abort_with_reason + 32
3   libobjc.A.dylib               	       0x1899a5484 _objc_fatalv(unsigned long long, unsigned long long, char const*, char*) + 128
4   libobjc.A.dylib               	       0x1899a5404 _objc_fatal(char const*, ...) + 44
5   libobjc.A.dylib               	       0x18998bc1c performForkChildInitialize(objc_class*, objc_class*) + 400
6   libobjc.A.dylib               	       0x189972390 initializeNonMetaClass + 572
7   libobjc.A.dylib               	       0x18998f304 initializeAndMaybeRelock(objc_class*, objc_object*, locker_mixin>&, bool) + 164
8   libobjc.A.dylib               	       0x189971dc4 lookUpImpOrForward + 892
9   libobjc.A.dylib               	       0x189971764 _objc_msgSend_uncached + 68
10  CoreFoundation                	       0x189dcb128 _CFStringGetFormatSpecifierConfiguration + 32
11  CoreFoundation                	       0x189dc7d0c __CFStringAppendFormatCore + 316
12  CoreFoundation                	       0x189efe844 _CFStringCreateWithFormatAndArgumentsReturningMetadata + 184
13  CoreFoundation                	       0x189e11b9c CFStringCreateWithFormatAndArguments + 160
14  CoreFoundation                	       0x189dc7b70 CFStringCreateWithFormat + 48
15  Kerberos                      	       0x19a5b7df0 __init_log_block_invoke + 56
16  libdispatch.dylib             	       0x189b8c910 _dispatch_client_callout + 20
17  libdispatch.dylib             	       0x189b8e14c _dispatch_once_callout + 32
18  Kerberos                      	       0x19a5b7db4 mshim_log_entry + 112
19  Kerberos                      	       0x19a5b9824 cc_initialize + 64
20  libkrb5.3.3.dylib             	       0x1065404b0 api_macos_ptcursor_next + 196
21  libkrb5.3.3.dylib             	       0x10653d788 krb5_cccol_cursor_next + 76
22  libkrb5.3.3.dylib             	       0x10653da70 krb5_cccol_have_content + 92
23  libgssapi_krb5.2.2.dylib      	       0x1036b5894 acquire_cred_context + 1664
24  libgssapi_krb5.2.2.dylib      	       0x1036b519c acquire_cred_from + 688
25  libgssapi_krb5.2.2.dylib      	       0x1036a7180 gss_add_cred_from + 624
26  libgssapi_krb5.2.2.dylib      	       0x1036a6dc8 gss_acquire_cred_from + 400
27  libgssapi_krb5.2.2.dylib      	       0x1036a6c2c gss_acquire_cred + 36
28  libpq.5.13.dylib              	       0x103667cf8 pg_GSS_have_cred_cache + 60
29  libpq.5.13.dylib              	       0x103656dd4 PQconnectPoll + 4400
30  pg_ext.bundle                 	       0x1035b8900 gvl_PQconnectPoll_skeleton + 24
31  libruby.3.2.dylib             	       0x103af2f38 rb_nogvl + 268
32  pg_ext.bundle                 	       0x1035b88d8 gvl_PQconnectPoll + 44
33  pg_ext.bundle                 	       0x1035bece4 pgconn_connect_poll + 48
34  libruby.3.2.dylib             	       0x103b42b18 vm_call_cfunc_with_frame + 232
35  libruby.3.2.dylib             	       0x103b43380 vm_call_symbol + 572
36  libruby.3.2.dylib             	       0x103b44e88 vm_sendish + 1160
37  libruby.3.2.dylib             	       0x103b28528 vm_exec_core + 8064
38  libruby.3.2.dylib             	       0x103b3a0bc rb_vm_exec + 2164
39  libruby.3.2.dylib             	       0x103b494e0 invoke_block_from_c_bh + 932
40  libruby.3.2.dylib             	       0x103b33aec rb_yield + 180
41  libruby.3.2.dylib             	       0x103996570 rb_protect + 356
42  libruby.3.2.dylib             	       0x103a65ab4 rb_f_fork + 144
43  libruby.3.2.dylib             	       0x103b42b18 vm_call_cfunc_with_frame + 232
44  libruby.3.2.dylib             	       0x103b44e88 vm_sendish + 1160
45  libruby.3.2.dylib             	       0x103b284dc vm_exec_core + 7988
46  libruby.3.2.dylib             	       0x103b3a0bc rb_vm_exec + 2164
47  libruby.3.2.dylib             	       0x103995798 rb_ec_exec_node + 300
48  libruby.3.2.dylib             	       0x103995604 ruby_run_node + 96
49  ruby                          	       0x102d8bf34 main + 104
50  dyld                          	       0x1899bd0e0 start + 2360

Thread 1:
0 libsystem_kernel.dylib 0x189d061ec poll + 8
1 libruby.3.2.dylib 0x103afcd50 timer_pthread_fn + 172
2 libsystem_pthread.dylib 0x189d3e034 _pthread_start + 136
3 libsystem_pthread.dylib 0x189d38e3c thread_start + 8

Here we see:

  1. The krb5 call to api_macos_ptcursor_next eventually calls into cc_initialize, which calls Apple's mshim_log_entry.
  2. mshim_log_entry attempts to call init_log, which callsCFSTR("com.apple.MITKerberosShim").
  3. This is a macro for CFStringCreateWithFormat.
  4. CFStringCreateWithFormat eventually calls an internal method _CFStringGetFormatSpecifierConfiguration, which invokes the initializeNonMetaClass routine.

I believe this is similar to the grpc case where it's not sufficient to just load a framework; we actually need krb5 to call something like mshim_log_entry before the fork to initialize the relevant Objective C classes.

I think this suggests we need to investigate an upstream fix to krb5 and pq, unless we want some ugly ffi or fiddle workaround.

Nice find. I'm quite unfamiliair with the postgres eco-system though. krb5 and pq are both C libraries right? And the pg gem link / compile them?

I fear convincing these projects to fix fork safety may take a while if at all possible. Is there some fix we could implement in the PG gem, at least in the meantime?

The simplest thing to do right now is to default gssencmode: disable in the database.yml to disable the use of GSSAPI. We have that set in our database.yml in multiple projects. I wonder if Rails should make that the default in the PostgreSQL adapter and force users to set it explicitly if they want to use it.

I wonder if Rails should make that the default in the PostgreSQL adapter and force users to set it explicitly if they want to use it.

That would be a breaking change though. If it's really rarely used we could consider it, but...

Description

If this can help, I am facing the same error.
The application works on ubuntu without any problems.
When running on mac os - error
objc[30025]: +[__NSCFConstantString initialise] may have been in progress in another thread when fork() was called.
This is due to recent changes in puma settings
workers ENV.fetch('WEB_CONCURRENCY') { 2 }

System env

$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]
$ rails -v
Rails 7.1.2
$ uname -a
Darwin MBA.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:10 PST 2023; root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64
$ pg_ctl -V
pg_ctl (PostgreSQL) 16.1 (Homebrew)

backtrace

 rdbg -A /var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-29990
DEBUGGER (client): Connected. PID:30056, $0:puma: cluster worker 1: 29990 [souz]

# No sourcefile available for /Users/as/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb
=>#0	[C] Thread#join at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  #1	Puma::Cluster::Worker#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  # and 29 frames (use `bt' command for all frames)

Stop by SIGURG
(rdbg:remote) bt    # backtrace command
=>#0	[C] Thread#join at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  #1	Puma::Cluster::Worker#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  #2	Puma::Cluster#worker(index=1, master=29990) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:206
  #3	block in spawn_worker at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:99
  #4	[C] Kernel#fork at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:99
  #5	Puma::Cluster#spawn_worker(idx=1, master=29990) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:99
  #6	block in spawn_workers at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:81
  #7	Integer#times at <internal:numeric>:237
  #8	Puma::Cluster#spawn_workers at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:74
  #9	Puma::Cluster#check_workers at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:163
  #10	Puma::Cluster#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:436
  #11	Puma::Launcher#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/launcher.rb:194
  #12	Puma::RackHandler#run(app=#<Souz::Application>, options={:Port=>3000, :Host=>"0.0.0.0", :binds=>...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/rack/handler/puma.rb:76
  #13	Rackup::Server#start(block=nil) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:341
  #14	Rails::Server#start(after_stop_callback=#<Proc:0x0000000128aecd78 /Users/as/.frum...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:38
  #15	block {|server=#<Rails::Server:0x0000000123a74c60 @_serv...|} in perform at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:145
  #16	Kernel#tap at <internal:kernel>:90
  #17	Rails::Command::ServerCommand#server at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:136
  #18	Thor::Command#run(instance=#<Rails::Command::ServerCommand:0x0000000..., args=[]) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor/command.rb:28
  #19	Thor::Invocation#invoke_command(command=#<struct Thor::Command name="server", des..., args=[[]]) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor/invocation.rb:127
  #20	Rails::Command::Base#invoke_command(command=#<struct Thor::Command name="server", des...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command/base.rb:178
  #21	#<Class:Thor>#dispatch(meth="server", given_args=["-b", "0.0.0.0", "-p", "3000"], given_opts=nil, config={:current_command=>#<struct Thor::Command...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor.rb:527
  #22	#<Class:Rails::Command::Base>#perform(command="server", args=["-b", "0.0.0.0", "-p", "3000"], config={:current_command=>#<struct Thor::Command...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command/base.rb:73
  #23	block in invoke at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command.rb:71
  #24	Rails::Command.with_argv(argv=["-b", "0.0.0.0", "-p", "3000"]) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command.rb:149
  #25	Rails::Command.invoke(full_namespace="server", args=["-b", "0.0.0.0", "-p", "3000"], config={:current_command=>#<struct Thor::Command...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command.rb:69
  #26	<main> at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands.rb:18
  #27	[C] Kernel.require at ~/.frum/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74
  #28	block {|name="/Users/as/.frum/versions/3.3.0/lib/ruby/...|} in replace_require (2 levels) at ~/.frum/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74
  #29	Kernel#require(path="rails/commands") at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32
  #30	<main> at bin/rails:4
(rdbg:remote)

Errors

18:59:38 web.1  | DEBUGGER[bin/rails#30027]: Debugger can attach via UNIX domain socket (/var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-29990)
18:59:38 web.1  | [29990] - Worker 1 (PID: 30027) booted in 0.01s, phase: 0
19:00:03 web.1  | Started GET "/" for 127.0.0.1 at 2024-01-09 19:00:03 +0300
19:00:03 web.1  | objc[30027]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
19:00:03 web.1  | objc[30027]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
19:00:03 web.1  | DEBUGGER[bin/rails#30032]: Debugger can attach via UNIX domain socket (/var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-29990)
19:00:03 web.1  | [29990] - Worker 1 (PID: 30032) booted in 0.01s, phase: 0
19:00:04 web.1  | Started GET "/" for 127.0.0.1 at 2024-01-09 19:00:04 +0300
19:00:04 web.1  | objc[30025]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
19:00:04 web.1  | objc[30025]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
19:00:04 web.1  | DEBUGGER[bin/rails#30035]: Debugger can attach via UNIX domain socket (/var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-29990)
19:00:04 web.1  | [29990] - Worker 0 (PID: 30035) booted in 0.02s, phase: 0
19:00:05 web.1  | Started GET "/" for 127.0.0.1 at 2024-01-09 19:00:05 +0300

How to make application work

  1. $ WEB_CONCURRENCY=0 bin/dev
    No errors.
  2. export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES bin/dev
    Some errors, but application work
19:20:57 web.1  | [31196] - Worker 0 (PID: 31230) booted in 0.02s, phase: 0
19:20:57 web.1  | #<Thread:0x000000013179a248@DEBUGGER__::Server::reader /Users/as/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/debug-1.9.1/lib/debug/server.rb:44 run> terminated with exception (report_on_exception is true):
19:20:57 web.1  | /Users/as/.frum/versions/3.3.0/lib/ruby/3.3.0/socket.rb:205:in `bind': Address already in use - bind(2) for /var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-31196 (Errno::EADDRINUSE)
19:20:57 web.1  | 	from /Users/as/.frum/versions/3.3.0/lib/ruby/3.3.0/socket.rb:205:in `listen'
19:20:57 web.1  | 	from /Users/as/.frum/versions/3.3.0/lib/ruby/3.3.0/socket.rb:1121:in `unix_server_socket'
19:20:57 web.1  | 	from /Users/as/.frum/versions/3.3.0/lib/ruby/3.3.0/socket.rb:1169:in `unix_server_loop'
19:20:57 web.1  | 	from /Users/as/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/debug-1.9.1/lib/debug/server.rb:502:in `accept'
19:20:57 web.1  | 	from /Users/as/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/debug-1.9.1/lib/debug/server.rb:49:in `block in activate'
19:20:57 web.1  | [31196] - Worker 1 (PID: 31231) booted in 0.02s, phase: 0
19:20:57 web.1  | #<Thread:0x0000000131799ed8@DEBUGGER__::SESSION@server /Users/as/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/debug-1.9.1/lib/debug/session.rb:179 aborting> terminated with exception (report_on_exception is true):
19:20:57 web.1  | /Users/as/.frum/versions/3.3.0/lib/ruby/3.3.0/socket.rb:205:in `bind': Address already in use - bind(2) for /var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-31196 (Errno::EADDRINUSE)
$ rdbg -A /var/folders/wn/c7ygz1bj57vg06q7_94pb4d80000gn/T/rdbg-501/rdbg-31196
DEBUGGER (client): Connected. PID:31232, $0:puma: cluster worker 0: 31196 [souz]

# No sourcefile available for /Users/as/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb
=>#0	[C] Thread#join at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  #1	Puma::Cluster::Worker#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  # and 29 frames (use `bt' command for all frames)

Stop by SIGURG
(rdbg:remote) bt    # backtrace command
=>#0	[C] Thread#join at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  #1	Puma::Cluster::Worker#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster/worker.rb:143
  #2	Puma::Cluster#worker(index=0, master=31196) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:206
  #3	block in spawn_worker at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:99
  #4	[C] Kernel#fork at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:99
  #5	Puma::Cluster#spawn_worker(idx=0, master=31196) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:99
  #6	block in spawn_workers at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:81
  #7	Integer#times at <internal:numeric>:237
  #8	Puma::Cluster#spawn_workers at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:74
  #9	Puma::Cluster#check_workers at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:163
  #10	Puma::Cluster#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/cluster.rb:436
  #11	Puma::Launcher#run at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/puma/launcher.rb:194
  #12	Puma::RackHandler#run(app=#<Souz::Application>, options={:Port=>3000, :Host=>"0.0.0.0", :binds=>...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.0/lib/rack/handler/puma.rb:76
  #13	Rackup::Server#start(block=nil) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rackup-2.1.0/lib/rackup/server.rb:341
  #14	Rails::Server#start(after_stop_callback=#<Proc:0x000000012ef88048 /Users/as/.frum...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:38
  #15	block {|server=#<Rails::Server:0x0000000129ed4c00 @_serv...|} in perform at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:145
  #16	Kernel#tap at <internal:kernel>:90
  #17	Rails::Command::ServerCommand#server at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands/server/server_command.rb:136
  #18	Thor::Command#run(instance=#<Rails::Command::ServerCommand:0x0000000..., args=[]) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor/command.rb:28
  #19	Thor::Invocation#invoke_command(command=#<struct Thor::Command name="server", des..., args=[[]]) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor/invocation.rb:127
  #20	Rails::Command::Base#invoke_command(command=#<struct Thor::Command name="server", des...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command/base.rb:178
  #21	#<Class:Thor>#dispatch(meth="server", given_args=["-b", "0.0.0.0", "-p", "3000"], given_opts=nil, config={:current_command=>#<struct Thor::Command...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/thor-1.3.0/lib/thor.rb:527
  #22	#<Class:Rails::Command::Base>#perform(command="server", args=["-b", "0.0.0.0", "-p", "3000"], config={:current_command=>#<struct Thor::Command...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command/base.rb:73
  #23	block in invoke at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command.rb:71
  #24	Rails::Command.with_argv(argv=["-b", "0.0.0.0", "-p", "3000"]) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command.rb:149
  #25	Rails::Command.invoke(full_namespace="server", args=["-b", "0.0.0.0", "-p", "3000"], config={:current_command=>#<struct Thor::Command...) at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/command.rb:69
  #26	<main> at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-7.1.2/lib/rails/commands.rb:18
  #27	[C] Kernel.require at ~/.frum/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74
  #28	block {|name="/Users/as/.frum/versions/3.3.0/lib/ruby/...|} in replace_require (2 levels) at ~/.frum/versions/3.3.0/lib/ruby/3.3.0/bundled_gems.rb:74
  #29	Kernel#require(path="rails/commands") at ~/.frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/bootsnap-1.17.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32
  #30	<main> at bin/rails:4

@sergey-arkhipov Couple of questions to run through on macOS:

  1. Do you have preload_app! in your Puma config?
  2. Do you have a before_fork block that attempts to connect to the database?
  3. Can you try to run this with gssencmode: disable set in your database.yml?
  • Do you have preload_app! in your Puma config?
    Yes
  • Do you have a before_fork block that attempts to connect to the database?
    No
  • Can you try to run this with gssencmode: false set in your database.yml?
ActiveRecord::ConnectionNotEstablished
invalid gssencmode value: "false"
...
      raise ActiveRecord::DatabaseConnectionError.hostname_error(conn_params[:host])
          else
            raise ActiveRecord::ConnectionNotEstablished, error.message
          end
        end

The correct value is gssencmode: disable. This fixed the issue for us.

The correct value is gssencmode: disable. This fixed the issue for us.

Thanks.

Yes. it's working. No errors.

Ah, right, sorry about that. Yes, gssencmode: disable.

I'm still curious if preload_app! and making database connections in before_fork would solve the majority of the issues without setting gssencode:disable. I've seen mixed reports of this, though I would need to stack traces if it continues to crash.

I'm still curious if preload_app! and making database connections in before_fork

Note that puma may not be the only thing forking in development, e.g. spring, etc.

Also, rather than preload_app, I think user would be better to stick with cluster mode disabled, but I may be missing why they need it?

I'm still curious if preload_app! and making database connections in before_fork would solve the majority of the issues without setting gssencode:disable. I've seen mixed reports of this, though I would need to stack traces if it continues to crash.

It crashes, I just tested my (Sinatra) app locally and on GitHub Actions (macos-13). You can see the logs at https://github.com/Starkast/wikimum/actions/runs/7487844025/job/20381074065#step:6:29

Thanks. I think there are actually two separate crashes here when the GSSAPI code is used; I had been thinking they were the same:

  1. [__NSCFConstantString initialize] may have been in progress error: This is described in the comment above. I this can be fixed by making a database connection before the application forks since the log system is initialized the first time it is called.
  2. Seg fault: I believe this occurs when macOS's internal _os_log_preferences_refresh is called inside a forked process. I think this is a macOS bug, and I just submitted a bug report to Apple (private link). I don't know how to work around this problem yet. The full backtraces are in the comment above and seen in the build logs.

For now, I suppose we should document gssencmode: disable as loudly as possible.

If anyone knows who to talk at Apple to get more attention to the second seg fault, please let me know!

developius

I am trying to fix this on a program that I am going to be selling. How can I implement that in the code so it automatically runs for everyone that downloads the program?