0

UPDATES

I'm having some issues on a new mac m1 and my install of ruby, rails, xcode and postgresql

First attempt:

##What I did ?

Installing homebrew, ruby, rails, postgresql

OS: macOS Big Sur Version 11.2.1 (20D74)

zsh: 5.8 (x86_64-apple-darwin20.0)

postgres: 13.2

Rails version: Rails 6.1.3

Ruby version: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]

Brew version: Homebrew 3.0.9

What I could do:

I have successfully:

  • create a rails app with rails new myApp -d postgresql
  • add gem devise to the Gemfile
  • run bundle install
  • create devise User and all CRUD views
  • run db:create, db:migrate
  • launch the server with rails s
  • access all the pages of login, sign up, etc...

Expected behavior

I'm expecting to be able to create an account and connect to it on the app.

Actual behavior

When I try to create an account I'm running into an error about the gem bcrypt that seems to run on the wrong architecture...

Second attempt:

I've uninstall ruby, rails, rbenv, postgresql, homebrew

I've update my OS version to: macOS Big Sur 11.2.3

I'm following this tutorial: gorails.com/setup/osx/11.0-big-sur

Brew version: Homebrew 3.0.11

rbenv version: rbenv 1.1.2

ruby versions:

  • 2.7.2 (set by /Users/lucas-illiano/.ruby-version) 3.0.0 (I can't put the 3.0.0 version to global...)

rails version: 6.1.1

  1. I've deleted rbenv before deleting all ruby versions on the system ? Is that why ?

At the end of the tutorial, before installing postgresql, it says to install this package macOS_SDK_headers_for_macOS_10.14.pkg

But I'm running into an issue about x-code and CommandLineTools install.

I've tried to download the package from here developer.apple.com/download/more I cannot get the folder /Library/Developer/CommandLineTools/

I've also tried xcode-select --install but x-code is already well install. No upgrade available.

I can't think of any other way to install successfully this package.

Anyone have an idea about the issue installing xcode and CommandLineTools on MacOS Big Sur?

Thanks by advance and have a good day to you all.

  • What do you mean by "I've tried to reinstall everything"? What is **everything**, and how did you reinstall it? Also, please try to avoid posting images in the question, unless it's absolutely the best way to describe something (e.g. a CSS layout question.) In your instance, *the most important text in your question* is actually in the image (!!), which says "No suitable image found. Did find: mach-o, but wrong architecture". – Tom Lord Apr 05 '21 at 22:27
  • You're most likely going to be running into quite a lot of issues running Ruby with ARM64 as many of the libraries it depends on are playing catchup. You really want to consider installing Ruby in Rosetta 2 (Apples x86 compatiblity layer) to preserve your sanity for the time being. https://www.lewis8s.codes/ruby/programming/apple/arm/arm64/2020/11/27/how-to-install-ruby-on-apple-silicon.html – max Apr 05 '21 at 22:43
  • 1
    Another question is why the gem is located in `vendor/bundle`. Did you actually intend to do that or did someone forget to add the directory to `.gitignore`? This would explain why doing `bundle uninstall bcrypt` - `bundle install bcrypt` doesn't actually fix the problem as gems in `vendor/bundle` will override your other gems. See https://stackoverflow.com/questions/12573596/what-is-the-purpose-of-vendor-bundle-heroku-tells-me-to-remove-it – max Apr 05 '21 at 22:47
  • @TomLord @max I have reinstall homebrew, rbenv and postgresql. I'm folling this tutorial now: https://gorails.com/setup/osx/11.0-big-sur I was able to reinstall ruby 2.7.2 and 3.0.0 ` rbenv versions 2.7.2 (set by /Users/lucas-illiano/.ruby-version) 3.0.0 ` not sure why but i can't set 3.0.0 to global. I also install rails 6.1.1 On the tutorial they advise to install xcode commandlinetools I've tried to download the package from here https://developer.apple.com/download/more/ I cannot get the folder `/Library/Developer/CommandLineTools/` – elviajero34 Apr 08 '21 at 22:14
  • I've tried `xcode-select --install` but x-code is already well install. No upgrade available. As I've read, the installation of the package `macOS_SDK_headers_for_macOS_10.14.pkg`might resolve further problem about the pg gem. I've just upgrade my os to macOS Big Sur 11.2.3 I can't think of any other way to install successfully this package. Anyone have a tips ? Thanks by advance – elviajero34 Apr 08 '21 at 22:23

1 Answers1

0

Not sure if this will help you. If you were able to run the server then xcode, and other things are probably good already.

I am not much into Ruby/Rails now but from what I understand. Some gems are not supported for Apple M1 arch yet. If you're getting an error similar to missing compatible arch then using arch -arch x86_64 before the command may help.

In my case, where I was running another gem - Jekyll, using arch -arch x86_64 solved my problem.

> bundle exec jekyll build --> failed with arch error

But,

> arch -arch x86_64 bundle exec jekyll build --> works just fine
Ravi Kumar Gupta
  • 1,698
  • 2
  • 22
  • 38