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)

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

    Edit:
    Since this was written other package managers have been written. So use the package manager of your choice(asdf, mise-en-place, ..) to install Ruby and configure the options and leave system Ruby as is.