Search code examples
ruby-on-railsmacos-monterey

rails new fails with 'couldn't set additional authenticated data' on macos


I'm trying to get ruby on rails working on a new Mac with an M1 chip. Running rails new fails after append .gitignore with the following error

/Library/Ruby/Gems/2.6.0/gems/activesupport-6.0.3/lib/active_support/message_encryptor.rb:173:in `auth_data=': couldn't set additional authenticated data (OpenSSL::Cipher::CipherError)
  • MacOS version: 12.3.1 Monterey, Chip: Apple M1 Max
  • Ruby version: 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
  • Rails version: 6.0.3
  • Node version: 14.19.0
  • Yarn version: 1.22.18

Has anyone else run into this? My rage-googling hasn't come up with much of anything on this one


Solution

  • Instead of using system ruby, I would suggest using rbenv to install gems to avoid version conflicts. Then you can use export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" to set the correct SSL version