Rails Rails Ruby console command failed

/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `require': dlopen(/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError) Referenced from: /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle Reason: image not found - /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle from /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `<top (required)>' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `require' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `<top (required)>' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require_command!' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:68:in `console' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>' 

This is my error screen after trying to execute a command. I tried uninstalling and reinstalling readline, and this did not help. I just study the rails and don’t know what I am doing 100% (just following the manual), so this type of error has passed my understanding. Thanks!

+7
ruby ruby-on-rails
source share
6 answers

It may not be connected, but today the same thing happened to me.

This morning I had a fully functioning Ruby 2.3.1. In my case, Ruby was compiled and installed using ruby-build and is managed by rbenv.

At some point, I updated Homebrew with

 brew cleanup --prune=30 brew update brew upgrade 

One of the improved formulas was readline 7.0:

 $ brew info readline ... /usr/local/Cellar/readline/7.0 (45 files, 2M) Poured from bottle on 2016-10-05 at 08:09:22 

Soon afterword, I discovered that my readline support for Ruby was completely broken. I saw errors similar to yours:

 /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `require': dlopen(/Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError) Referenced from: /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle Reason: image not found - /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle from /Users/mbrictson/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/pry-0.10.4/lib/pry/config/default.rb:151:in `lazy_readline' 

The solution was to completely remove my Ruby installation and recompile it:

 rm -rf ~/.rbenv/versions/2.3.1 rbenv install 2.3.1 

I know that you are using rvm, not rbenv, but perhaps the solution in your case is similar: remove your Ruby installation and reinstall it with rvm.

+13
source share

A very quick and quick solution is to add rb-readline to your Gemfile. (In case other solutions do not work, and you want to move on until you have time to solve the problem. I know that this is not ideal, but it is a working solution.)

In GemFile:

group :development do gem 'rb-readline' end

Now just install the package. I found this solution on Option 4 at ( https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X ) I hope this helps.

+4
source share

Something is wrong with your rvm , it seems this is not related to rails. Check the installation.

Make sure you comply with the rvm prerequisites at https://rvm.io/rvm/prerequisites

and that your installation is working correctly, for example.

(from: https://rvm.io/rvm/install ) If the installation and configuration were successful, RVM should now boot when you open a new shell. This can be tested by running the following command, which should output rvm - this is a function, as shown below.

 $ type rvm | head -n 1 rvm is a function 

Check your mac if readline was compiled correctly, or try cleaning ruby-2.3.0 again

You can check the RVM regarding the package and autolibs at: https://rvm.io/packages/readline

+1
source share

I had a similar problem. My Ruby was installed using HomeBrew. In my case, I needed to remove Ruby; install / link libyaml; and then reinstall ruby.

 brew uninstall ruby brew link libyaml brew install ruby 
+1
source share

The same thing happened to me when I involuntarily ran rvm requirements after installing ruby ​​2.3.1.

 rvm uninstall 2.3.1 rvm install 2.3.1 

The above is fixed.

0
source share

Running this from the command line worked for me:

 ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib 

from github

0
source share

All Articles