-1

I have a friend's website code, which is in Ruby on Rails.

I have tried to install RoR on my Mac using instructions at gorails.com

OS : Mac Mojave
ruby -v : ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin18]
rails -v :

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem railties (>= 0.a) (Gem::GemNotFoundException)
    from /usr/local/bin/rails:22:in `<main>'

What I tried : I installed ruby, and then rails, using gorails tutorial, and kept getting errors stating version number mismatch.
Keep in mind that creating a new app, worked, but trying to run this existing code is a problem.
So then I uninstalled everything and updated the version using rvm, and since then I am getting this error.

When I cd into the webapp folder and run bundle install, I get errors, such as:

zsh: /Users/abc/.rvm/gems/ruby-2.2.3@hs/bin/bundle: bad interpreter: /Users/abc/.rbenv/versions/2.5.3/bin/ruby: no such file or directory
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using
RVM are available at rvm.io/packages/openssl.

This project uses a PostgreSQL database, which I have setup already. If required, I can share the gemfile of this project too.

What is the best way to get this project working?
Am I missing something crucial?

E_net4
  • 27,810
  • 13
  • 101
  • 139
Aman Alam
  • 11,231
  • 7
  • 46
  • 81
  • 2
    check these links, they might help: [first](https://github.com/rvm/rvm/issues/4357), [second](https://stackoverflow.com/questions/15212104/ruby-and-you-must-recompile-ruby-with-openssl-support-or-change-the-sources-in), One more thing, you have to clear your question, add things like your OS, Rails and Ruby version you are working on and what you have tried. – Amr Adel Mar 03 '19 at 17:48
  • 1
    Why do you have RVM and rbenv at the same time? – mechnicov Mar 03 '19 at 18:08
  • Thanks @AmrAdel, I added more details. – Aman Alam Mar 04 '19 at 03:21
  • @mechnicov : I am a newbie in RoR, and this could be because of my ignorance, sorry – Aman Alam Mar 04 '19 at 03:21

1 Answers1

2

You can't run RVM and RBENV on the same machine. Pick one and remove the other. You're probably best to uninstall both and then pick one, start over.

Uninstall RBENV instructions here or in your case probably brew uninstall rbenv

Uninstall RVM see How can I remove RVM (Ruby Version Manager) from my system?

Close all terminals and then start a new one.

Install RVM see https://rvm.io/rvm/install

Then go to your project, make sure you have the correct ruby version needed by your project. If not, you will need to install with rvm install 2.5.1 for example.

Then run

rvm use 2.5.1 #or some other version

Then you should be able to run bundle install

The rest of the instructions in your link should be ok.

lacostenycoder
  • 10,623
  • 4
  • 31
  • 48
  • 1
    Thank you so much. This path led me to the position where openssl support was required, so I researched and got that fixed, then I had to fix issues related to rmagick, ports etc. I kept reading through the error message and now I am at a point where my `bundle install` succeeds. Which is exactly what I wanted. Thanks! – Aman Alam Mar 04 '19 at 15:14