Ruby cannot load such file - active_support/core_ext/object/blank

RubyRubygemsHomebrew

Ruby Problem Overview


I was trying to run brew doctor but system popped up error of

> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in > `require': cannot load such file -- > active_support/core_ext/object/blank (LoadError)

Searched online and another post suggested to just "gem install activesupport" but then I ran into error of:

ERROR:  Error installing activesupport:
	i18n requires Ruby version >= 2.3.0.

I also tried to rvm install ruby-2.3.0 but the same error popped again

[2019-02-26 10:07:41] requirements_osx_brew_libs_install
requirements_osx_brew_libs_install ()  { 
    brew install "$@" --force || { 
        \typeset ret=$?;
        requirements_osx_brew_libs_error "installation";
        return $ret
    } } current path: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
PATH=/Users/{user_name}/.aw/pex_resources/scripts/binaries:/usr/local/sbin:/Users/fengjiao/.rbenv/shims:/Users/{user_name}/.nvm/v0.10.32/bin:/Users/fengjiao/bin:/usr/local/sbin:/usr/local/bin:/Users/{user_name}/.rbenv/shims:/Users/{user_name}/.nvm/v0.10.32/bin:/Users/{user_name}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki:/opt/X11/bin:/Users/fengjiao/gocode/bin:/Users/{user_name}/.rvm/bin
command(10): requirements_osx_brew_libs_install autoconf automake
libtool pkg-config coreutils libyaml readline libksba openssl@1.1
++ brew install autoconf automake libtool pkg-config coreutils libyaml readline libksba openssl@1.1 --force
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file --
active_support/core_ext/object/blank (LoadError) 	from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
`require' 	from /usr/local/Homebrew/Library/Homebrew/global.rb:10:in
`<top (required)>' 	from
/usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `require_relative'
	from /usr/local/Homebrew/Library/Homebrew/brew.rb:21:in `<main>'
++ typeset ret=1
++ requirements_osx_brew_libs_error installation
++ rvm_warn 'There were package installation errors, make sure to read the log.

Try `brew tap --repair` and make sure `brew doctor` looks reasonable.

Ruby Solutions


Solution 1 - Ruby

Running brew style fixed this issue for me.


Update

As mentioned in the comments, for some people the solution is:

brew update-reset

Solution 2 - Ruby

Had the same problem. I had to run brew update-reset to fix it.

Solution 3 - Ruby

I face the 'sunspot_rails-2.1.0' issue while upgrade the ruby version ruby 2.2 to ruby 2.5 for rails 4.2 and here I would like to share with you which has worked for me.

"LoadError: no such file to load -- active_support/core_ext/object/to_json"

Refrence: https://github.com/sunspot/sunspot/pull/555/files

Solution 4 - Ruby

In my case, I have to force homebrew/linuxbrew to use its own portable-ruby to fix it.

I am running ArchLinux with ruby 2.7.0 installed, after I switch to homebrew's portable-ruby by export HOMEBREW_FORCE_VENDOR_RUBY=1 as described in the manpage and issue brew update, homebrew automatically downloads portable-ruby 2.6.3, and everything's back to normal.

I think the root cause might be homebrew's incompatible with a higher version of ruby.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJudyJiangView Question on Stackoverflow
Solution 1 - RubyCorné VerbruggenView Answer on Stackoverflow
Solution 2 - RubycrisscrossView Answer on Stackoverflow
Solution 3 - RubyBinny BView Answer on Stackoverflow
Solution 4 - RubyBruce SunView Answer on Stackoverflow