0

When I try the following, after installing Ruby 3.0 from snap on Ubuntu 18.04::

gem install rails

I get this error:

/snap/ruby/201/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb:13:in `<module:RbConfig>': ruby lib version (3.0.0) doesn't match executable version (2.5.1) (RuntimeError)

It was right after using

rails new rest-api-messages --api --database=postgresql

and trying to install PostGRES

gem install pg -v '1.2.3' --source 'https://rubygems.org/'

How could I solve this? is Ruby on Rails only for version 2.5.1 and lower?


edit: Then I got

Can't find the 'libpq-fe.h header when trying to install pg gem

Solved with

sudo apt-get install libpq-dev

Duplicate from Can't find the 'libpq-fe.h header when trying to install pg gem

Antonin GAVREL
  • 9,682
  • 8
  • 54
  • 81

1 Answers1

2

My guess is you already had Ruby 2.5 installed and they are stepping on each other. Ruby versions don't overwrite each other. You need to uninstall Ruby 3.0 and 2.5 and install a Ruby version manager then install Ruby using it. This will also give you a path to move forward easily. Check out Ruby version manager like rbenv or RVM. Take a look at both. For what it's worth. I have used both and finally settled on rbenv.

Mike Chilson
  • 91
  • 1
  • 2