OS X El Capitan version 10.11.2
I attempted brew update, but this error message is displayed.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'
I also attempted brew install zsh, but the above message is displayed.
Please let me know how to fix this error message.
Found an answer which worked for me here: https://stackoverflow.com/a/35495897/1354137
The problem mainly occurs after updating OS X to El Capitan (OS X 10.11). This is mainly because of file permission issues with file El Capitan’s new SIP process. Try changing permissions of /usr/local directory.
$ sudo chown -R $(whoami):admin /usr/local
If it still doesn't work, use following steps and everything will be fine. This may be because homebrew is not updated.
1. open terminal
2. $ cd /usr/local
3. $ git reset --hard
4. $ git clean -df
5. $ brew update
Related
I upgraded Rails to 7.0.1. When I do the rails g controller Pages home, it's giving the error:
>>rails g controller Pages home
/home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require': libffi.so.8: cannot open shared object file: No such file or directory - /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi_c.so (LoadError)
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi.rb:5:in `rescue in <main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ffi-
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootstrap-5.1.3/lib/bootstrap/engine.rb:4:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sassc-rails-2.1.2/lib/sassc/rails.rb:5:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.5/lib/bundler.rb:176:in `require'
from /home/shadman/instagram/config/application.rb:7:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/actions.rb:22:in `require_application!'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/generate/generate_command.rb:21:in `perform'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from bin/rails:4:in `<main>'
Any idea how to fix this?
You can compile ffi gem with internal libffi that comes with it. Make sure the version matches:
gem install ffi --version "1.15.5" -- --disable-system-libffi
I don't know why ffi compiles fine with system libffi, but then refuses to run with it.
Update (not a solution, just some debugging)
The culprit for me was linuxbrew. I didn't have libffi.so.8 so it was weird that ffi was expecting it for some reason:
$ fd "libffi.so" /usr
/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
/usr/lib/x86_64-linux-gnu/libffi.so
/usr/lib/x86_64-linux-gnu/libffi.so.7
When ffi is compiling it's checking for libffi and ffi.h and other things. You can do it in irb:
>> require "mkmf"
>> pkg_config("libffi")
=> ["-I/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/include ", "-L/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/lib/../lib", "-lffi"]
I assume this is because pkg-config is coming from linuxbrew:
$ which -a pkg-config
/home/linuxbrew/.linuxbrew/bin/pkg-config
/usr/bin/pkg-config
/bin/pkg-config
$ pkg-config --libs libffi
-L/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/lib/../lib -lffi
$ /bin/pkg-config --libs libffi
-lffi
But that never came up in any searches I tried before. Well, derp, it's a hidden directory:
$ fd -H "libffi.so" /home/linuxbrew
...
/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/lib/libffi.so.8
# there it is ^
So during configuration and compilation ffi finds everything it needs, seems to point to the correct lib locations, which makes it compile just fine. But when it runs, it can't find it:
$ ldd /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/ext/ffi_c/ffi_c.so
linux-vdso.so.1 (0x00007ffea8b22000)
libruby.so.3.1 => /home/alex/.rbenv/versions/3.1.2/lib/libruby.so.3.1 (0x00007f5d04ba8000)
libffi.so.8 => not found
...
If I take linuxbrew out of my path it compiles and runs fine with libffi.so.7 that I have through apt:
$ ldd /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/ext/ffi_c/ffi_c.so
...
libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007fdcaa104000)
...
I don't know how dynamic libraries actually work, to explain it. It links to non-standard libruby.so.3.1 location from rbenv just fine.
As another workaround, symlinks solve everything:
$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s /home/linuxbrew/.linuxbrew/lib/libffi.so.8
$ ldd /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/ext/ffi_c/ffi_c.so
libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007f03de9ee000)
Most probably you need to install libffi. On CentOS/RHEL/Fedora systems you will need to execute:
sudo dnf -y install libffi
When I was working on a rails project I realized there was a difference in versions between the system and project one thus my solution was matching the two:
gem uninstall ffi
gem install ffi -v 1.15.0 -- --disable-system-libffi
Ubuntu version (20.04)
Update my ubuntu from 20.04 to 20.10 and install Ruby version 3.0.2 and Ruby On Rails version 7.0.0 .
That solved the error.
Working my way through a RoR tutorial. All was well until yesterday when I came across a bunch or errors that I can't understand. It looks like an openssl issue, but what I've read of that involves stuff I'm not using. I didn't add or update any gems. In fact, git shows no changes since my last commit which was working prior to yesterday. Any thoughts? What could have changed from one day to the next. I think the only thing I did was update postgresql using Homebrew. Might that have had some negative Thanks.
/usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': dlopen(/usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/x86_64-darwin17/digest/md5.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
Referenced from: /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/x86_64-darwin17/digest/md5.bundle
Reason: image not found - /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/x86_64-darwin17/digest/md5.bundle
from /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.5.0/gems/rubocop-0.54.0/lib/rubocop/processed_source.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.5.0/gems/rubocop-0.54.0/lib/rubocop.rb:613:in `require_relative'
from /usr/local/lib/ruby/gems/2.5.0/gems/rubocop-0.54.0/lib/rubocop.rb:613:in `<top (required)>'
from /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /usr/local/Cellar/ruby/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
from /usr/local/lib/ruby/gems/2.5.0/gems/rubocop-0.54.0/bin/rubocop:6:in `<top (required)>'
from /usr/local/bin/rubocop:23:in `load'
from /usr/local/bin/rubocop:23:in `<main>'
looks like you need to install openssl
in macOS you can do it with brew install openssl and than install your gems again with brew install --force to make sure that the correct library path was used during the compilation
in case it won't work try installing openssl version 1.0 (since that's the version mention in the stacktrace) with brew install openssl#1.0 and then reinstalling your gems again
did you upgrade your OS? or did it happen by itself maybe?
I updated my osx to Mavericks 10.9 from 10.7, and since then I have been having issues running 'rails s'.
The issue is with Rmagick, and I have tried almost every solution that I could find. Most people recommended reinstalling imagemagick through homebrew, and reinstalling rmagick gem, but that didn't work. I even uninstalled homebrew as a whole, and reinstalled it. I tried getting rid of gemfile.lock, and running bundle install again, but none of these worked.
Here is the error message I get when I try running the rails local server:
Kibaeks-MacBook-Pro:onvard_saas kibaek$ rails s
/Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/gems/rmagick-2.13.2/lib/rmagick.rb:11:in `require': dlopen(/Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/extensions/x86_64-darwin-12/2.1.0-static/rmagick-2.13.2/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.5.dylib (LoadError)
Referenced from: /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/extensions/x86_64-darwin-12/2.1.0-static/rmagick-2.13.2/RMagick2.bundle
Reason: image not found - /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/extensions/x86_64-darwin-12/2.1.0-static/rmagick-2.13.2/RMagick2.bundle
from /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/gems/rmagick-2.13.2/lib/rmagick.rb:11:in `<top (required)>'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `require'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `each'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `block in require'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `each'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `require'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.1/lib/bundler.rb:131:in `require'
from /Users/kibaek/onvard_saas/config/application.rb:13:in `<top (required)>'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
from /Users/kibaek/.rvm/gems/ruby-2.1.0#onvard/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I had trouble with this as well on OS 10.9. I tried many things and this is what worked for me (after installing Xcode 5):
brew install libtool --universal
brew link libtool
Quick research just found the following with other users who also had success:
Stack Overflow: rmagick-error-after-installing-os-x-mavericks
TheKUnit Blog: RMagick errors running rake tasks os x maverick
Edit: Another possibility is that you have a different version of RMagick than the gem is looking for (possibly from the reinstall). Your log shows your gem is looking for /usr/local/lib/libMagickCore.5.dylib which I am guessing it cannot find. Do
ls /usr/local/lib/
and see if you can find that file. If not, a
gem pristine rmagick
may help if you haven't already tried it. In my case I have Core 6 in that folder and not 5.
I've reinstalled the Ruby version a bunch of times, but I couldn't find why, when I go to the terminal and type rails c, it throws this error:
.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /Users/cleytonmessias/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/irb/completion.rb:9:in `<top (required)>'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `require'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands.rb:51:in `require'
from /Users/cleytonmessias/.rvm/gems/ruby-2.0.0-p247#trustvox/gems/railties-4.0.3/lib/rails/commands.rb:51:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I'm on Mac OSX Mavericks, Ruby-2.0.0-p247 and Rails 4.
I finally found a reference that helped me.
Using this link:
brew install readline
brew link readline
I went to file ~/.rvm/user/db and add the following line: ruby_configure_flags=--with-readline-dir=/usr/local/opt/readline
rvm reinstall 2.0.0-p247 --with-openssl-dir=/usr/local
Now when I type rails c it's working again :)
I've got some errors in my Rails app and I'm trying to start the Rails console by issuing following command:
rails console
No matter what I try, I'm always getting the same error:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've really tried every possible solution I found on the net, as many people encounter the same error. Unfortunately, nothing seems to work. When I try the following command:
ruby /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb
I get following output
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
*** /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb failed ***
Indicating that something is missing, but installing readline with apt-get doesn't make a difference either. I'm guessing it could have something to do with incompatible gem versions, as the console worked briefly some time ago. Are there any known version issues with readline? Very much people seem to have encountered problems with this gem.
Try putting rb-readline in your Gemfile and check this out https://stackoverflow.com/a/9595841/1905235
If you are running Rails 4.x it is possible that Spring is causing this issue.
Try stopping the Spring process bundle exec spring stop
Then run bundle exec rails c
I finally found a solution. It was a conjunction of several issues (gem versions, conflicting readline libraries).
Firstly, I refetched the readline lib
sudo apt-get install libreadline-dev
Then I uninstalled ruby
rvm remove 2.1.1
I installed ruby again
rvm install 2.1.1
I told RVM to use the default (2.1.1) Ruby
rvm use default
I reinstalled Rails and readline
gem install rails
gem install readline
I got an error again launching the console, but a slightly different one:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': /usr/local/lib/libreadline.so.6: undefined symbol: UP - /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
So following this instructions (http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/), I got it to work:
cd /usr/local/lib
mkdir temp
mv libreadline* temp
ldconfig
apt-get update
Thanks to hunterboerner for the help!
This worked out ok on a Solaris machine that had no readline, might work for you:
$ bundle exec irb
irb(main):001:0> require File.expand_path('config/boot')
=> true
irb(main):002:0> require File.expand_path('config/environment')
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /export/home/deploy/recon/shared/bundle/ruby/1.8/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
irb(main):027:0> require 'console_app'
=> true
I had this problem a while back, solved by typing: rvm requirements and installing what came back. Seemed to, although this was an older version of rvm so may no longer be relevant
rvm reinstall 2.7.0
worked for me