Ask A Question

Notifications

You’re not receiving notifications from this thread.

Setup MacOS 12 Monterey Discussion

Chris Oliver asked in General

Hello Chris,

Thanks a lot for this guide. I was having a really hard time trying to install homebrew and rails on my MacBook after I installed Monterey. 😃

Reply

Where can I find a link to the setup guide? I can see the discussion, but not the original guide that everyone is talking about.

Edit: Never mind, found it. In case anyone else is looking.... see gorails.com/setup/osx/12-monterey

Reply

Hello Chris,

I'm following the guide to install Rails in my new Macbook Pro M1, but I'm running into trouble. Even though I've setup rbenv global 3.0.2, installing Rails fails for me with the following message which makes me think it's using the version from system ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin21]. What can I do? Thanks in advance!

gem install rails -v 6.1.4.1
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

Reply

You likely figured it out already, but possibly this will help others: restart your terminal and you should see 3.0.2

Reply

Just run it with sudo ;-)

Reply

Hi, even after restarting the terminal, the error is still there.

Error installing rails:
There are no versions of activesupport (= 7.0.0) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.8.205.

How should I resolve this? Thanks!

Reply

Oh, wait! I found my answer! After setting the global version, I needed to close the terminal, open another, run rbenv rehash.

Reply

~ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
installer: Error - the package path specified was invalid: '/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg'.

Reply

This step is only necessary for Mohave

Reply

Same problem on Monterrey

Reply

Same problem on Monterrey (+1)

Reply

You would want to run xcode-select --install for Monterey on your terminal then it should be working.

Reply

I have tried that, got this message:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

I tried several different things, always ending with the error:

/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:170:in `auth_data=': couldn't set additional authenticated data (OpenSSL::Cipher::CipherError)

So frustating.

Reply

Hi anyone with solution

Reply

Any solution yet?

Reply

That's great, but can we use Rails 7.0.0.alpha2 for our new project or should I wait for a stable release?

Reply

I got errors running "rails new ". It was during webpacker:install. First it said "node is missing", so I installed that with brew "brew install node", then after that it erred out with "yarn is missing", and again installed it "brew install yarn". After that it was fine.

Reply

Hi,
While creating new blog I am getting below error. How to fix this?

append .gitignore
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:170:in `auth_data=': couldn't set additional authenticated data (OpenSSL::Cipher::CipherError)

Reply

Hi, You can just install openssl it will worked for me :)
brew install openssl

Reply

Hi, I did install the openssl and I'm getting the same error (I already restarted the Terminal several times).

Reply

I'm getting this error message when I try to create a new Rails app:

/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.4.1/lib/active_support/message_encryptor.rb:170:in `auth_data=': couldn't set additional authenticated data (OpenSSL::Cipher::CipherError)

I tried with the system version of Ruby and with the 3.0. :(

Reply

Got same problem

Reply

I cannot get this to work on a Mac M1.
I've got brew running, ruby on latest version, and rails as documented.
had issues running mysql so opted for POSTgreSQL, that's all OK it seems.
Created the database fine, then when I use rails server, I get a truck load of errors.

The first of them is 'Webpacker configuration file not found'

Reply

I'have problem... with Mac M1 Cannot install PG gem rails :-(, there is a problem...

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /Users/***/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/pg-1.1.4/ext

/Users//.rbenv/versions/3.1.2/bin/ruby -I /Users/**/.rbenv/versions/3.1.2/lib/ruby/3.1.0 -r
./siteconf20220604-26393-svwfqr.rb extconf.rb
checking for pg_config... yes
Using config values from /opt/homebrew/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)

Undefined symbols for architecture x86_64:
"_PQconnectdb", referenced from:
_t in conftest-ae9e39.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include
4:
5: /*top
/
6: extern int t(void);
7: int main(int argc, char *argv)
8: {
9: if (argc > 1000000) {
10: int (
volatile tp)(void)=(int ()(void))&t;
11: printf("%d", (*tp)());
12: }
13:
14: return !!argv[argc];
15: }
16: int t(void) { void ((*volatile p)()); p = (void ((
)()))PQconnectdb; return !p; }
/* end */

Reply

I've resolved my issues with the following steps.

brew install node
rails new myapp --database=postgresql
brew services start postgresql
cd myapp
rake db:create
rails s

server starts, installs all dependencies and away we go.

Reply

issue with sqlite3 - couldn't solve it...

gem install sqlite3 -v '1.3.13'
->
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.

current directory: /Users/jongwonlee/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13/ext/sqlite3

/Users/jongwonlee/.rbenv/versions/3.0.1/bin/ruby -I /Users/jongwonlee/.rbenv/versions/3.0.1/lib/ruby/3.0.0 -r ./siteconf20220126-86864-nxrxo3.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for rb_integer_pack()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile

current directory: /Users/jongwonlee/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13/ext/sqlite3
make DESTDIR= clean

current directory: /Users/jongwonlee/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13/ext/sqlite3
make DESTDIR=
compiling backup.c
compiling database.c
database.c:60:3: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rb_check_safe_obj(file);
^
database.c:60:3: note: did you mean 'rb_check_safe_str'?
/Users/jongwonlee/.rbenv/versions/3.0.1/include/ruby-3.0.0/ruby/internal/core/rstring.h:97:6: note: 'rb_check_safe_str' declared here
void rb_check_safe_str(VALUE);
^
database.c:201:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return INT2NUM((long)sqlite3_total_changes(ctx->db));
~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
database.c:242:67: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
VALUE result = rb_funcall(handle, rb_intern("call"), 1, INT2NUM((long)count));
~~~~~~~ ~~~~~~~~~~
database.c:552:18: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
return INT2NUM((long)sqlite3_errcode(ctx->db));
~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 1 error generated.
make: *** [database.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jongwonlee/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sqlite3-1.3.13 for inspection.
Results logged to /Users/jongwonlee/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/extensions/x86_64-darwin-21/3.0.0/sqlite3-1.3.13/gem_make.out

Reply

@jongwon. What happens if you add gem sqlite3 to your Gemfile and bundle install?

Reply

:( M1 macbook Pro, Monterey 12.0.1, everything "by the book" (meaning following the steps above) except it doesn't think rails is installed...
Maybe some env var missing?

% rails -v
Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.
<<<<<<
% ruby -v
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin21]
% gem -v
3.3.3

Reply

Hey everyone,

I am trying to set up on my mac pro m1.
I have followed the instructions to the letter and when I run:
rake db:create

`rake aborted!
NameError: uninitialized constant RubyLsp::T

VERSION = T.let(File.read(File.expand_path("../VERSION", dir)).strip, String)
^
/Users/wasonga/Desktop/rails/sample/config/application.rb:7:in <top (required)>'
/Users/wasonga/Desktop/rails/sample/Rakefile:4:in
require_relative'
/Users/wasonga/Desktop/rails/sample/Rakefile:4:in <top (required)>'
(See full trace by running task with --trace)

I am getting the following error.

can anyone assist?

Reply

I fixed this by removing Cassandra which I had installed 'by accident', and after uninstalling everything on this guide and beginning a clean install, it ended up working.
I am a happy man now.

Reply

Hi guys I posted a comment linking to a gist but haven't seen it up yet. anyways here's a whole post for anyone else who needs the help:

Installing ruby with rbenv on a Mac m2 using a bash terminal

https://www.zedtopia.com/ideas/installing-ruby-with-rbenv-on-a-mac-m2-using-a-bash-terminal-because-go-rails-only-has-zsh-instructions

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.