I have recently been having a lot of trouble with my rubies.
Now whenever I try and run bundle install on my projects I get the following error:
bundle install
/usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler- 1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies': uninitialized constant Gem::Security::Policies (NameError)
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/cli.rb:175:in `<class:CLI>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/cli.rb:6:in `<module:Bundler>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/cli.rb:5:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/bin/bundle:18:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/bin/bundle:23:in `load'
from /usr/local/rvm/gems/ruby-2.0.0-p247#global/bin/bundle:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
I have tried reinstalling rubies, I have tried rvm get head and gem update --system
I have also tried uninstalling and re-installing OpenSSL, through rvm package and brew install.
And I have tried completely imploding RVM and starting again, but none of this seems to work. This seemed to happen after I shifted to Mavericks.
Does anybody out there have an idea what might be happening? I have been at this for 3 days...
Edit:
I am having the same issue with all these rubies:
1.9.3
2.0.0-p195
2.0.0-p247
2.1.0-preview1
Assuming you're using brew...
Run brew doctor to check the current state and perform any steps it recommends.
Run rvm list and note which versions of ruby are installed. Remove the offending ruby version with rvm remove 2.0.x where 'x' is the minor revision you are working with, or run rvm remove 2.0 to remove them all.
Now upgrade to the latest rvm, rvm get stable.
Let rvm install dependencies automatically by running rvm autolibs enable. This will allow rvm to install whatever it needs during the ruby installation, including openssl. It will use brew, as I am assuming here, but will also use fink or macports if they are installed instead. In the past I have had problems with brew and macports both installed.
Install the latest ruby via rvm, rvm install 2.0.
Bundler should now work.
When running bundle install on a new rvm gemset running Ruby 2.0 and Rails 4.0 on OSX Mavericks, I was receiving the same error:
gems/bundler-1.3.5/lib/bundler/rubygems_integration.rb:172:in `security_policies': uninitialized constant Gem::Security::Policies (NameError)
Running 'brew install openssl', then 'rvm reinstall 2.0' worked for me.
Have you tried using the --trust-policy=[] option with bundle install?
To Apply the Rubygems security policy named policy, where policy is one of HighSecurity, MediumSecurity, LowSecurity, or NoSecurity.
More - http://bundler.io/v1.3/man/bundle-install.1.html
Related
/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 the command. I've tried to uninstall and reinstall readline and that did not help. I am just learning rails and do not 100% know what I am doing (just following a guide) so this type of error is past my understanding. Thanks!
Might not be related, but I had the same thing happen to me today.
I had a fully-functioning Ruby 2.3.1 working fine this morning. In my case, Ruby was compiled and installed by ruby-build and managed by rbenv.
At one point today I updated Homebrew with
brew cleanup --prune=30
brew update
brew upgrade
One of the formulae upgraded 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
Shortly afterwords I found that my readline support for Ruby had become completely broken. I saw errors just like 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 delete my Ruby installation and recompile it:
rm -rf ~/.rbenv/versions/2.3.1
rbenv install 2.3.1
I know you are using rvm and not rbenv, but perhaps the solution in your case is similar: delete your Ruby installation and re-install it using rvm.
A really fast and quick solution is to add rb-readline to your Gemfile.
(In case the other solutions don't work and you want to move on until you have time to address the issue. I know it this is not ideal but it is a working solution.)
In the GemFile:
group :development do
gem 'rb-readline'
end
Now, just bundle install. 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 it helps.
There's something wrong with your rvm, it doesn't seems to be related with rails. Please verify if it's installed properly.
Ensure that you've checked the rvm prerequisites on https://rvm.io/rvm/prerequisites
and that your install is working properly, e.g.
(from: https://rvm.io/rvm/install)
If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command which should output rvm is a function as shown below.
$ type rvm | head -n 1
rvm is a function
Check on your mac if readline has been properly compiled, or try to do a clean install ruby-2.3.0 again
You can check on RVM regarding the package and autolibs on: https://rvm.io/packages/readline
I had similar issue. My Ruby was installed using HomeBrew. In my case I needed to uninstall Ruby; install/link libyaml; and then reinstall ruby.
brew uninstall ruby
brew link libyaml
brew install ruby
Same thing happened to me when I unwittingly ran rvm requirements after installing ruby 2.3.1.
rvm uninstall 2.3.1
rvm install 2.3.1
Above fixed it.
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
After running:
$ bundle exec rake
I receive this error:
/Users/user/Documents/Code/spree_gem/vendor/bundle/gems/json-
1.8.2/lib/json/ext/parser.bundle: [BUG] Segmentation fault at 0x00000000000418
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64darwin14.0]
Along with this:
/Users/user/Documents/Code/spree_gem/vendor/bundle/bin/rake:23
:in `<main>'
/Users/user/Documents/Code/spree_gem/vendor/bundle/bin/rake:23
:in `load'
/Users/user/Documents/Code/spree_gem/vendor/bundle/gems/rake-
10.4.2/bin/rake:33:in `<top (required)>'
I've tried $ gem pristine --all. Any thoughts?
I had the same error too. Googled around and found these two posts
http://community.onemonth.com/t/install-rvm-error/1883/25
https://bugs.ruby-lang.org/issues/9444
The first post's solution fixed it for me, so for you it would be:
rvm get stable
rvm reinstall ruby-2.1.5
This worked for me:
Uninstall ruby: rvm remove 2.2.1
Install ruby: rvm install 2.2.1
Reinstall rails: sudo gem install rails
Reinstall missing gems: bundle install
Update RubyGems gem install rubygems-update
Reset gems gem pristine --all
Maybe you'll have to rerun bundle install
Try running rails server rails s
Actually, just recalling rvm use ruby-2.2.5 fixed this for me, and is less destructive than the other solutions.
I have got the same error
But below configuration will start working for me.
rvm pkg install iconv
rvm pkg install openssl
rvm reinstall 2.1.5 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr
Also it was working whileI have made in Gemfile by replacing
source 'https://rubygems.org'
this line with
source 'http://rubygems.org'
To install RoR on my Mac (v10.9.2), I decided to follow the instructions for Ruby 1.9.2 here: https://stackoverflow.com/a/8464619/2278546
"rvm install 1.9.2" was taking too long, so based on suggestions on SO, I used "rvm requirements" to install each of the requirements individually with macports. I then executed "rvm install 1.9.2" and it ran much faster.
When I tried to execute "gem install rail", I got an error message saying
activesupport requires Ruby version >= 1.9.3
As a result, I went back and tried again with 1.9.3:
rvm install 1.9.3
rvm --default 1.9.3
gem update
gem install rails
This time, during the rails install command, the process got stuck installing the documentation for rails. I decided to interrupt and run this instead:
gem install --no-ri --no-rdoc rails
This worked! I ran the following:
rails new pong; cd pong; rails generate controller welcome index
The last command in that string gave me the following error:
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:17:in
fiddle_func': uninitialized constant Spring::SID::DL (NameError)
from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:30:in
sid' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/sid.rb:39:in
pgid' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:78:in
set_pgid' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:34:in
boot' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/server.rb:14:in
boot' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:36:in
block in boot_server' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:34:in
fork' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:34:in
boot_server' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/run.rb:18:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/command.rb:7:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/rails.rb:23:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client/command.rb:7:in
call' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/client.rb:26:in
run' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/bin/spring:48:in
<top (required)>' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/binstub.rb:11:in
load' from
/Users/me/.rvm/gems/ruby-1.9.3-p545/gems/spring-1.1.2/lib/spring/binstub.rb:11:in
<top (required)>' from /Users/me/Coding/pong/bin/spring:16:in
require' from /Users/me/Coding/pong/bin/spring:16:in <top
(required)>' from bin/rails:3:inload' from bin/rails:3:in `'
Based on suggestions read here and here and elsewhere, I decided to try with a different compiler:
port install gcc46
CC=`which gcc-mp-4.6`
rvm reinstall 1.9.3
gem install
rvm reinstall 1.9.3
Same problem with this installation as well.
I suspect interrupting those builds might have left things in a bad state. First off, uninstall 1.9.2. 1.9.3-p545 is the oldest supported version, as of now at least.
Next, uninstall the gem 'spring-commands-rspec' and run a gem pristine -all. Then do another bundle install. FWIW, I am able to run spring on my 10.9.2 macbook. You may have to reinstall the xcode command line tools if your gcc is giving you issues.
Beyond all that, you don't need spring to run a rails app. It's primarily a helper during development and testing. Once you get things cleaned up, I would just remove the thing from your Gemfile until you actually need it.
I was able to get things running by mixing #Andrew's advice with some common sense...
I first cleaned up the mess I had made:
sudo rvm remove 1.9.2
sudo rvm remove 1.9.3
sudo rvm remove 1.9.3-p545
sudo gem uninstall spring-commands-rspec
sudo gem pristine -a
sudo port uninstall rvm
I then reinstalled rvm
sudo port install rvm
and reinstalled Ruby 1.9.3 with rails:
sudo rvm install 1.9.3
sudo gem update
sudo gem install --no-ri --no-rdoc rails
The problem as described above still occurred.
I then remembered that I had received the following message when installing Ruby (confirming Andrew's comment):
WARNING: Please be aware that you just installed a ruby that is no
longer maintained (2014-02-23), for a list of maintained rubies visit:
http://bugs.ruby-lang.org/projects/ruby/wiki/ReleaseEngineering
Please consider upgrading to ruby-2.1.1 which will have all of the
latest security patches.
So, I cleaned up again:
sudo rvm remove 1.9.3
sudo rvm remove 1.9.3-p545
sudo gem uninstall spring-commands-rspec
sudo gem pristine -a
Then, I tried installing Ruby 2.1.1 and Rails:
sudo rvm install 2.1.1
sudo gem update
sudo gem install --no-ri --no-rdoc rails
This time, I got no errors when I tried to run
rails new pong; cd pong; rails generate controller welcome index
This is not an ideal answer because I still couldn't get 1.9.3 to work, but it fits my purposes (I think). Anyone have any theories explaining why 1.9.3 doesn't work?
Thanks,
Grasswistle
I cannot execute rails console due to this error:
localhost:TwitterForZombies wiz$ rails c
/Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `require': dlopen(/Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.2.dylib (LoadError)
Referenced from: /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/readline.bundle
Reason: image not found - /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin12.2.1/readline.bundle
from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:3:in `require'
from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands/console.rb:3:in `<top (required)>'
from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:38:in `require'
from /Users/wiz/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have installed readline via homebrew.
I'd like to keep using rbenv instead of rvm.
Thank you for reading my question.
I had the same issue recently with homebrew and libreadline.7.x.dylib / libreadline.6.x.dylib
I solved it by running:
ln -s /usr/local/opt/readline/lib/libreadline.7.0.dylib /usr/local/opt/readline/lib/libreadline.6.dylib
source: https://github.com/rails/rails/issues/26658
Homebrew is great, but once in a while it doesn't play nice with some of the other moving parts.
A brew update && brew upgrade brought in libreadline.7.x.dylib while automatically removing libreadline.6.x.dylib, which ruby was still relying on.
There may be more clever ways to fix the problem, but brute force worked for me:
$ rbenv uninstall 2.3.1
$ rbenv install 2.3.1
$ cd /path/to/my/app
$ bundle
The above assumes the presence of rbenv's ruby-build and, of course, bundler; replace 2.3.1 with whatever version of ruby you are using.
Please note that similar problems can occur with different homebrew-managed libraries (see my own answer to this, for example)
I'm on OSX, ruby2.3.0, rails5. Adding gem 'rb-readline' to my Gemfile fixed this problem.
I got the same error with Ruby 2.1.0, and rails 4.0. After searching and trying a lot, finally it work well:) Here are what I did:
rvm cleanup all
rvm autolibs enable
rvm install 2.1.0
The other ways:
brew update
brew uninstall readline
brew install readline
The autolibs command will force RVM install all dependencies, so you don't need to worry about it.
Hope it's helpful.
As Sachin hinted, installing readline and then reinstalling ruby is the ideal approach - but the details are a bit different for rbenv. Given your file paths, I'm guessing you're on a Mac, so the following should help:
brew install readline ruby-build
env CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 1.9.3-p286
This was taken from the ruby-build Wiki and a quick google search.
Using mac, El Captain version, it is possible to fix just by doing
rvm reinstall your_ruby_version
(like rvm reinstall ruby-2.3.1)
Hope this helps, good luck!
taken from github user #enderahmetyurt (this is the only solution that worked for me).
Solution: Add gem 'rb-readline' to your Gemfile in development group and bundle install. It's the easiest solution for silly "readline" errors.
try installing readline, and reinstall your ruby
https://rvm.io/packages/readline/
I'm having this issue whenever i run "gem install rails":
usr/local/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
Ruby and Rubygems were both installed from source. I've installed libyaml from source and from apt-get. I'm running ubuntu 12.04. I am NOT running RVM as far as I know (trying "rvm" returns "bla bla bla not installed apt-get". I'm pretty sure this speaks of 2 separate issues but I need solutions to both. Thanks.
RVM is best tool for easily install, manage, and work with multiple ruby environments.
https://rvm.io/rvm/install/ follow the instructions in this link to get RVM working.
Then you should install 'libtool' before you install 'libyaml'.
sudo apt-get install libtool
rvm pkg install libyaml
rvm reinstall 1.9.3
these commands are using for installing libyaml.
After installing this you can install rails using
gem install rails