[ruby-core:122731] [Ruby Bug#21510] Rails server crashes on Mac M2 with Bus Error at 0x0000000109946aac

Issue #21510 has been reported by jkvithanage (Janaka Vithanage). ---------------------------------------- Bug #21510: Rails server crashes on Mac M2 with Bus Error at 0x0000000109946aac https://bugs.ruby-lang.org/issues/21510 * Author: jkvithanage (Janaka Vithanage) * Status: Open * ruby -v: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin24] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I have been struggling to setup a Rails 5.1.7 application on my Macbook M2 for months. I installed Rosetta, x86_64 brew and my terminal app is set to run with Rosetta. ``` shell ~ ❯ arch i386 ~ ❯ which brew /usr/local/bin/brew ~ ❯ brew list ==> Formulae abseil coreutils icu4c@77 lz4 pkgconf xz autoconf gdbm krb5 m4 postgresql@14 yarn automake gettext libffi mysql protobuf@29 zlib bison gh libnghttp2 node readline zstd brotli git libtool node-build redis c-ares glib libunistring nodenv ruby-install ca-certificates gmp libuv openssl@3 shared-mime-info chruby heroku libyaml pcre2 terminal-notifier ==> Casks ~ ❯ ``` `bundle install` works perfectly fine. Then I can run rails commands like `rails console` and `rails db:` commands with no issues. I can also execute commands inside `rails console` too. `rails server` launches the server as well, but as soon as I accessed the port 3000 on the browser, it crashes with this bus error. ``` Started GET "/" for ::1 at 2025-07-12 22:54:20 +1000 /Users/jkv-mbp/.gem/ruby/2.6.6/gems/pg-0.21.0/lib/pg.rb:56: [BUG] Bus Error at 0x0000000109946aac ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin24] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. ``` It seems like an issue related to `pg` gem. Since this doesn't work on macOS, I installed Asahi Linux on it and setup the application. Although, its `aarch64` linux, the application can be launched without any issues. But, it's not a reliable solution for my work setup. It would be great someone can help me with this issue. I have attached a complete crash report and the Gemfile of the project. ---Files-------------------------------- server.log (657 KB) Gemfile (5.93 KB) -- https://bugs.ruby-lang.org/

Issue #21510 has been updated by jkvithanage (Janaka Vithanage). Although the issue seems related to `pg` gem, I can run activerecord statements on a rails console session and they work perfectly fine. In that case, I may assume that this is not exactly a `pg` gem related issue. ---------------------------------------- Bug #21510: Rails server crashes on Mac M2 with Bus Error at 0x0000000109946aac https://bugs.ruby-lang.org/issues/21510#change-114014 * Author: jkvithanage (Janaka Vithanage) * Status: Open * ruby -v: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin24] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I have been struggling to setup a Rails 5.1.7 application on my Macbook M2 for months. I installed Rosetta, x86_64 brew and my terminal app is set to run with Rosetta. ``` shell ~ ❯ arch i386 ~ ❯ which brew /usr/local/bin/brew ~ ❯ brew list ==> Formulae abseil coreutils icu4c@77 lz4 pkgconf xz autoconf gdbm krb5 m4 postgresql@14 yarn automake gettext libffi mysql protobuf@29 zlib bison gh libnghttp2 node readline zstd brotli git libtool node-build redis c-ares glib libunistring nodenv ruby-install ca-certificates gmp libuv openssl@3 shared-mime-info chruby heroku libyaml pcre2 terminal-notifier ==> Casks ~ ❯ ``` `bundle install` works perfectly fine. Then I can run rails commands like `rails console` and `rails db:` commands with no issues. I can also execute commands inside `rails console` too. `rails server` launches the server as well, but as soon as I accessed the port 3000 on the browser, it crashes with this bus error. ``` Started GET "/" for ::1 at 2025-07-12 22:54:20 +1000 /Users/jkv-mbp/.gem/ruby/2.6.6/gems/pg-0.21.0/lib/pg.rb:56: [BUG] Bus Error at 0x0000000109946aac ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin24] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. ``` It seems like an issue related to `pg` gem. Since this doesn't work on macOS, I installed Asahi Linux on it and setup the application. Although, its `aarch64` linux, the application can be launched without any issues. But, it's not a reliable solution for my work setup. It would be great someone can help me with this issue. I have attached a complete crash report and the Gemfile of the project. ---Files-------------------------------- server.log (657 KB) Gemfile (5.93 KB) -- https://bugs.ruby-lang.org/

Issue #21510 has been updated by peterzhu2118 (Peter Zhu). Status changed from Open to Closed Thank you for the bug report. You appear to be running on Ruby 2.6, which was EOL in 2022. As such, I'll be closing this issue. The currently supported Ruby versions are Ruby 3.3 and 3.4, please upgrade and open a new ticket if you encounter any issues. ---------------------------------------- Bug #21510: Rails server crashes on Mac M2 with Bus Error at 0x0000000109946aac https://bugs.ruby-lang.org/issues/21510#change-114015 * Author: jkvithanage (Janaka Vithanage) * Status: Closed * ruby -v: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin24] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I have been struggling to setup a Rails 5.1.7 application on my Macbook M2 for months. I installed Rosetta, x86_64 brew and my terminal app is set to run with Rosetta. ``` shell ~ ❯ arch i386 ~ ❯ which brew /usr/local/bin/brew ~ ❯ brew list ==> Formulae abseil coreutils icu4c@77 lz4 pkgconf xz autoconf gdbm krb5 m4 postgresql@14 yarn automake gettext libffi mysql protobuf@29 zlib bison gh libnghttp2 node readline zstd brotli git libtool node-build redis c-ares glib libunistring nodenv ruby-install ca-certificates gmp libuv openssl@3 shared-mime-info chruby heroku libyaml pcre2 terminal-notifier ==> Casks ~ ❯ ``` `bundle install` works perfectly fine. Then I can run rails commands like `rails console` and `rails db:` commands with no issues. I can also execute commands inside `rails console` too. `rails server` launches the server as well, but as soon as I accessed the port 3000 on the browser, it crashes with this bus error. ``` Started GET "/" for ::1 at 2025-07-12 22:54:20 +1000 /Users/jkv-mbp/.gem/ruby/2.6.6/gems/pg-0.21.0/lib/pg.rb:56: [BUG] Bus Error at 0x0000000109946aac ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin24] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. ``` It seems like an issue related to `pg` gem. Since this doesn't work on macOS, I installed Asahi Linux on it and setup the application. Although, its `aarch64` linux, the application can be launched without any issues. But, it's not a reliable solution for my work setup. It would be great someone can help me with this issue. I have attached a complete crash report and the Gemfile of the project. ---Files-------------------------------- server.log (657 KB) Gemfile (5.93 KB) -- https://bugs.ruby-lang.org/
participants (2)
-
jkvithanage (Janaka Vithanage)
-
peterzhu2118 (Peter Zhu)