I've just moved over to Ubuntu 8.10 as my dev box; it's my first serious foray into Linux as a daily-use OS, and I'm having a hard time getting Rails going. I have followed a number of tutorials which all seem to work fine, but when I try and use gem install or gem update on anything, I get an error that looks like this:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
from /usr/local/bin/gem:21
I have (as recommended in the tutorials) installed zlib, zlib1g, and zlib1g-dev. I've even found a few tutorials on this particular problem (all for flavors other than mine, however) but they didn't help.
I'm on Ubuntu 8.10, ruby version 1.8.8dev gem version 1.3.2
I've tried reinstalling ruby and gems each and separately, to no avail.
If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/
The steps are:
rvm pkg install zlib
(or
rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)
then
rvm remove 1.9.1
rvm install 1.9.1
I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. So I downloaded the source for 1.9.2 and unzipped/unarchived it. my source distro is ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:
cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails
that fixed the problem. This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going.
I have the same problem in CentOS and fix it by executing the following command:
First, I ensure that zlib and zlib-devel exist (like many suggested above).
yum install zlib zlib-devel
Second, I recompiled and installed the sources of zlib that comes with ruby.
cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install
That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. Then I install rails with gem install rails. Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that)
That works for me...hope to you to.
Regards.
try
aptitude install zlib1g-dev
Then go about your business.
I really didn't like any of these answers ... none really focused on the users actual needs and question ... just people telling what they did ... no context and it didn't even work for me ...
So, ..
I'm installing a new box Ubuntu 8.04 LTS 64-bit ...
So, I ...
cd ~
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz
tar -xvvf ruby-1.9.2-p180.tar.gz
cd ruby-*
./configure
make
install
sudo make install
And then I have this problem with ...
gem list
it doesn't work ... something about zLib not found crap ...
So, I actually READ the README and find that I need to edit a file ...
[my ruby source directory]/ext/Setup
and UN-COMMENT the line with zLib in it ... by removing the "#" in the first column
Then I run the commands again ... included here for reference ...
./configure
make
install
sudo make install
and all is well ... it's logical ... and is devoid of "rvm" and other ... "just install more stuff to make it work" type solutions.
Joet
Just goto Ruby Source Package , Unzip it.
Goto /your-ruby-dir/ext/zlib
ruby extconf.rb
make
sudo make install
If the packages are missing it will tell you, mainly libzlib related packages
Regards
Saurabh
rvm package install zlib
rvm remove 1.9.1
rvm install 1.9.1
That did it. After numerous wild goose chases, I'm glad I found this page.
yes, and that didn't do the job either. Got this from another source, this finally did it for me where the other stuff failed.
wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar xvzf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb && make
sudo make install
Reinstall ruby gems from source
Thanks anyway, guys.
The problem is that Ruby on Ubuntu isn't built against zlib; you'll want to do a source build to install Ruby. You can do this with apt-get source -b ruby
Did you try apt-get install libzlib-ruby?
Also install rubygems from rubyforge. I don't like the rubygems package in Ubuntu.
On Debian (Squeeze):
libruby contains zlib for ruby amongst all the other stuff you'll need to make ruby work properly on Debian. So...
apt-get install libruby
Then...
cd /usr/local/src/ruby
make clean
make
make install
cd ../rubygems
ruby setup.rb
gem install rails
This made it work for me, but your mileage may vary. I did to a slight shotgun approach to zlib before finding that everything needed was covered by libruby.
You could try to download the ruby enterprise deb package on the phusion site. And install passenger through the package. Follow the instructions here.
Or you could try the bash script found here.
When running Rails I would not recommend using Ruby 1.8.8dev. Stick with 1.8.6, preferably the Ruby Enterprise Edition. See this post on RailsLab what other people are using.
If you insist on going hi-tech, install Ruby 1.9.1.
But in both cases build it yourself or use Marans suggestion.
Related
I wanted to start learning ror, but I have problem installing it. Thats what my console says when I type "sudo gem install rails" in.
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
This solved problem:
sudo apt-get install ruby-dev
References : http://railsapps.github.io/installrubyonrails-ubuntu.html
Prepare Your System
You’ll need to prepare your computer with the required system software before installing Ruby on Rails.
You’ll need superuser (root) access to update the system software.
Update your package manager first:
$ sudo apt-get update
This must finish without error or the following step will fail.
Install Curl:
$ sudo apt-get install curl
You’ll use Curl for installing RVM.
Install Ruby Using RVM
Use RVM, the Ruby Version Manager, to install Ruby and manage your Rails versions.
If you have an older version of Ruby installed on your computer, there’s no need to remove it. RVM will leave your “system Ruby” untouched and use your shell to intercept any calls to Ruby. Any older Ruby versions will remain on your system and the RVM version will take precedence.
Ruby 2.3.0 was current when this was written. You can check for the current recommended version of Ruby. RVM will install the newest stable Ruby version.
The RVM website explains how to install RVM. Here’s the simplest way:
$ \curl -L https://get.rvm.io | bash -s stable --ruby
Note the backslash before “curl” (this avoids potential version conflicts).
The “—ruby” flag will install the newest version of Ruby.
RVM includes an “autolibs” option to identify and install system software needed for your operating system. See the article RVM Autolibs: Automatic Dependency Handling and Ruby 2.0 for more information.
If You Already Have RVM Installed
If you already have RVM installed, update it to the latest version and install Ruby:
$ rvm get stable --autolibs=enable
$ rvm install ruby
$ rvm --default use ruby-2.3.0
Installation Troubleshooting and Advice
RVM Troubleshooting
If you have trouble installing Ruby with RVM, you can get help directly from the RVM team using the IRC (Internet Relay Chat) channel #rvm on irc.freenode.net:
http://webchat.freenode.net/?channels=rvm
If you’ve never used IRC, it’s worthwhile to figure out how to use IRC because the RVM team is helpful and friendly. IRC on freenode requires registration (see how to register).
You need a more recent version of Ruby to start with if you are using the latest version of Rails.
Ruby on Rails 4.0 Release Notes
Highlights in Rails 4.0:
Ruby 2.0 preferred; 1.9.3+ required
Whereas in your error message we see:
/usr/bin/ruby1.9.1 . . .
And, in future you should always include in your question the version numbers of all of the software components involved with your problem. It makes focusing on the real issue much simpler for people looking to help you.
I just switched from Heroku to Amazon Web Services. Previously I ran all of my Rails command line commands using my Command Prompt with Ruby (from my Windows PC). However, after I logged into my Amazon Linux EC2 instance, and then went into the directory of my app I receive this error:
/usr/bin/rails:9:in `require': no such file to load -- rubygems (LoadError)
from /usr/bin/rails:9
when I try to run any commands like rails console.
I reviewed this question, but it doesn't seem like multiple Ruby libraries apply to me because
which -a ruby
only yields one location:
/usr/bin/ruby
Also, this question didn't seem to help as I haven't. When I tried typing in
rvm use 1.9.3
I receive this message:
-bash: rvm: command not found
It's my first time seeing a Linux environment, so any help would be appreciated. Thank you!
I was running into he same issue with the identical error message. From my EC2 instance, I noticed my ruby version was 1.8 (ruby -v). I rebooted the EC2 instance, and this caused Elastic Beanstalk to spin up a new EC2 instance and terminate the old one. The new instance was running 1.9.3, and I became unblocked. I hate magical solutions, but with the old instance terminated, there was no more triage I could do. Hope this helps.
-bash: rvm: command not found
This clearly says that rvm is not installed on your machine or if installed you haven't set the path properly.
Check path
Sometimes there is gem versioning pointing to the wrong one.
This happened with me sometime back----
Disregard! sudo bundle install was bundling 2.3.8 instead of 3.0.0.beta3. Fixed it by specifying the version in my Gemfile.
To make sure the compilation goes smoothly, scroll back in your terminal session and look at the list of prerequisite packages that should be installed (it’s probably best to cut and paste the whole lot of names to save yourself from typing errors).
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion
Now you can use use rvm to download, compile, and install Ruby.
1 rvm install 1.9.3
2 rvm use 1.9.3 --default
Guess it's more of a problem related to RVM and some weird linkage to osx's system ruby? (I installed RVM on a user level)
I have used gem install bundler.
Then run rvm install works fine
I'm new to Ruby on Rails. I'm trying to install rails on an ubuntu linux platform. I've already installed RVM and ruby. When I type
gem install rails --version 3.0.0
I get this error:
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
Please help me install rails and learn a bit about the command line while I'm at it.
looks like you dont have ZLib installed. try gem install zlib and also apt-get install zlib zlib-dev if you dont have the system library installed
you need both the .so c-extension files (apt-get)
and the ruby interface to them (gem )
also this may be the same thing as in Antother Stackoverflow Question
I guess you need zlib package to install rails.
try
rvm pkg install zlib
after that
sudo apt-get install zlib1g
and then the development package. not sure why but you need it.
sudo apt-get install zlib1g-dev
then remove the current version of ruby because you didn't have zlib when ruby was compiled. type
rvm remove 1.9.2
(replace 1.9.2 with your version)
and then install it again with
rvm install 1.9.2
(again your version here)
That's basically it. I had the same error and it worked for me, hope it helps you too.
This has happened to me a few times. The answers near the bottom should fix it, but unfortunately you will need to remove and then recompile ruby :(
I have never gotten it to work without totally removing ruby.
http://ubuntuforums.org/showthread.php?t=1494997
I just upgraded to Rails 3 and had a bit of a mess with MacPorts, gems and databases to sort out. I threw out all the gems and installed them fresh. Everything seems to be OK except for the requirement of the pg gem.
After creating a new Rails 3 project, prepared for PostgreSQL, the server would not start, complaining about the missing pg gem. Doing bundle install, it chugged along for a while and, of course, fails on the pg gem.
Installing pg (0.10.0) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/pg-0.10.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/pg-0.10.0/ext/gem_make.out
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `each'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:446:in `build_extensions'
from /Library/Ruby/Site/1.8/rubygems/installer.rb:198:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
The most common suggestion I have found on forums and blogs is to (re)install the XCode developer tools. They were already there, but I reinstalled them anyway, with no better outcome than the above.
which ruby says /usr/bin/ruby, and ruby -v says ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0], if there's any clue there.
Pointers are welcome. Any missing information that would help figuring this out, I'll gladly and promptly provide!
I downloaded XCode since the DVD version is said to be broken and things went better for a while. bundle install started talking about "archflags" instead, so I did:
sudo env ARCHFLAGS="-arch i386" bundle install
and things seemed to go fine, until starting Rails barfed, saying:
/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle, 9): no suitable image found. Did find: (LoadError)
/Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.10.0/lib/pg_ext.bundle
Grappling for anything, I tried bundle install with archflags set to -arch x86_64, but it didn't go well:
*** Your PostgreSQL installation doesn't seem to have an architecture in common with the running ruby interpreter ([] vs. ["x86_64"])
I'll continue anyway, but if it fails, try setting ARCHFLAGS.
[...]
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Is libpq something I now have to supply a path to via some flags? Or am I completely out to lunch?
I encountered this error when I tried to install rails by gem on CentOS 6.3.
After googling a bit, I found a quick fix: installing the ruby-devel package.
sudo yum install ruby-devel
After that, everything worked fine.
Generally the gem bundles for Postgres want to know where pg_config is hiding so they can ask about the Postgres installation.
Use locate pg_config to see if your Mac knows where it's hiding.
I installed a copy of Postgres using mappstack, so my Mac says there's a copy at:
/Applications/mappstack-1.2-3/postgresql/bin/pg_config
and another at:
/Library/PostgreSQL/9.0/bin/pg_config
I don't remember installing the one at /Library/PostgreSQL/9.0, so it might have been preinstalled by Snow Leopard, or I did it when under the influence of too much work, possibly using the Postgres installer from EnterpriseDB.
Once you've found the location of pg_config try adding that directory to the start of your PATH and then rerun the gem install.
Or use:
export SQL_PATH=/Library/PostgreSQL/9.0
gem install pg -- --with-pg-config=$SQL_PATH/bin/pg_config
and try installing. If either of those work you're done. Otherwise...
The next thing the installers might want are access to the Postgres headers, so you look in the parent of the bin directories, and see if you can find an include directory.
After that, look in that directory for a lib directory. Once you know those locations you should have all you need to set your environment variables to let the installer complete. You'll need to read the README or INSTALL file of the installer and see what needs to be set up. You'll be configuring:
export include_dir=$SQL_PATH/include/
export lib_dir=$SQL_PATH/lib/
gem install pg -- --with-pgsql-include-dir=$include_dir --with-pgsql-lib-dir=$lib_dir
Hopefully that'll all help. I have Rails 3 and my Postgres running fine, using the mappstack Postgres and the EnterpriseDB versions, so the above info should get you there.
This worked for me on OS X 10.6.6, with PostgreSQL 9.0.1 installed from the source code:
export PATH=/usr/local/psql/bin:$PATH
export ARCHFLAGS='-arch x86_64'
gem install pg
You'll likely need to edit that PATH to match your postgres install location.
I've got postgres 1.9.0 installed via macports. OS X 10.5 PPC
This worked for me:
gem install pg -- --with-pg-lib=/opt/local/lib/postgresql90 --with-pg-include=/opt/local/include/postgresql90
Good luck!
Generally the gem bundles for Postgres want to know where pg_config is hiding . . .
Right - this could be the trick. If you just installed PostgreSQL and added it to your path, and did "bundle install" in an old shell, it won't be able to find pg_config. If that's the case, just get a new shell and try again. Otherwise, follow the steps above to find it and get it seen by bundler.
The macports install for postgresql83 works fine and plays nicely with rails right out of the box - that's another way to do it.
I just spent a good deal of time getting this to work tonight. I saw a similar error to this:
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
I tried different gem install variations:
gem install pg -- --with-pg-config=/Library/PostgreSQL/9.1/bin/ --with-pg-lib=/Library/PostgreSQL/9.1/lib/ --with-pg-include=/Library/PostgreSQL/9.1/include/
But finally what worked for me was:
gem install pg -- --with-pg-dir=/Library/PostgreSQL/9.1/
Also, before that I updated rvm (rvm get head) and reinstalled ruby (rvm --force install 1.9.2). Not sure if this helped or not, but it might be worth trying if you still hit issues
You might want to try going with homebrew for installing postgres (brew install postgres) and Ruby Version Manager for installing and maintaining ruby and ruby gems.
It'll leave your default versions (installed with OSX) untouched and give you more flexibility. For example, you could have different rails apps using rails 2 or 3 with ruby 1.8.7 and 1.9.2 all installed on the same system without problems.
This worked for me:
sudo env ARCHFLAGS="-arch x86_64" gem install pg
All the suggestions here and around the Web were incomplete for me, until I run the following on CentOS 6.6:
wget -c ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.3/x86_64/updates/security/kernel-devel-2.6.32-504.1.3.el6.x86_64.rpm && sudo yum install kernel-devel-2.6.32-504.1.3.el6.x86_64.rpm
wget -c ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.6/x86_64/updates/security/kernel-headers-2.6.32-504.30.3.el6.x86_64.rpm && sudo yum install kernel-headers-2.6.32-504.30.3.el6.x86_64.rpm
sudo yum groupinstall "Development Tools" "Development Libraries"
sudo yum -y install gcc gcc-c++ git ruby ruby-devel rubygems libvirt-devel mysql-devel postgresql-devel openssl-devel libxml2-devel sqlite-devel libxslt-devel zlib-devel readline-devel tar make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel ruby193-ruby-doc ruby193-ruby-devel ruby193-build
curl -L get.rvm.io | bash -s stable && source $HOME/.rvm/scripts/rvm && rvm requirements
Install Postgres.app:
http://postgresapp.com/
Verify what version was installed:
$ ls /Library/PostgreSQL/
# 9.4
Export the SQL_PATH:
export SQL_PATH=/Library/PostgreSQL/9.4
Install pg:
gem install pg -- --with-pg-config=$SQL_PATH/bin/pg_config
I am getting the following error:
$script/console
Loading development environment (Rails 2.2.2)
/opt/ruby-enterprise-1.8.6-20080709/lib/ruby/1.8/irb/completion.rb:10:in `require': no such file to load -- readline (LoadError)
Where can i get the file and what directory should it go in?
Thanks!
The readline module is normally part of the Ruby package itself.
Did you manually build your Ruby install? If so, you want to make sure libreadline and its headers are installed, and build again.
On Debian/Ubuntu:
apt-get install libreadline-dev
Or on RHEL/CentOS, try
yum install readline-devel
Update:
You are using a very old release of Ubuntu. If you want to keep using it, open /etc/apt/sources.list in a text editor, and change all occurrences of archive.ubuntu.com to old-releases.ubuntu.com. Then, run apt-get update and try the above again.
I urge you to consider updating your installation, though. Ubuntu 7.10 hasn't seen security updates in quite a while, and using it in production is not recommended. Even if it's not a production machine, there's a good chance you'll run into further problems because of old versions of certain libraries/dependencies.
You need to install the ncurses and readline libraries.
On Ubunutu you could do
sudo apt-get install libreadline5-dev libncurses5-dev
and then you will have to recompile readline which comes with your ruby source
cd <ruby-src-dir>/ext/readline
ruby extconf.rb
make
sudo make install
If you are using RVM you could simply do
rvm package install readline
EDIT:
On newer RVM versions, this last command is
rvm pkg install readline
Add the following line to your Gemfile and run bundle update
gem 'rb-readline'
credits to similar question/answer at install ruby 1.9.3 using rvm on ubuntu
This easiest way to get relief from this problem,
just add to your Gemfile:
gem 'rb-readline'
And then run bundle install
Run the command
rvm requirements
It shows the requirements and dependencies. Install those and reinstall the ruby on rvm
rvm remove 1.9.2
rvm install 1.9.2
It works!
EDIT
If you can't find the requirements option update your rvm.
rvm update --head # older rvm
or use rvm upgrade
Maybe this is a bullshit answer, but I ran into this problem today after upgrading postgres from 9.5.3 to 9.6, along with which homebrew upgraded readline from 6.something to 7. I ended up rolling back my postgres to 9.5.3 and that resolved the issue.