Brew: Linux: Homebrew conflicts with RVM, errors out with "cannot load such file -- irb"

Created on 16 May 2019  路  9Comments  路  Source: Homebrew/brew

  • [x] are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
  • [x] ran a brew command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [x] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [x] ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

brew upgrade on Linux

What happened (include command output)


Command output

1 nowaker@nwkr-desktop ~/projekty/dreamhost % brew upgrade
Error: cannot load such file -- irb
/home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/debrew/irb.rb:3:in require' /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/debrew/irb.rb:3:in /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/debrew.rb:4:in require' /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/debrew.rb:4:in /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:12:in require' /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/formula_installer.rb:12:in /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/reinstall.rb:3:in require' /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/reinstall.rb:3:in /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/cmd/upgrade.rb:4:in require' /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/cmd/upgrade.rb:4:in /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/utils.rb:22:in require' /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/utils.rb:22:inrequire?'
/home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:67:in `
'

What you expected to happen

Succeed.

Step-by-step reproduction instructions (by running brew commands)

  1. Install Arch Linux.
  2. Install RVM.

    • \curl -sSL https://get.rvm.io | bash -s stable

    • rvm install 2.6

    • rvm use 2.6

  3. brew update - will fail.

More info

nowaker@nwkr-desktop ~/projekty/dreamhost % which irb
/home/nowaker/.rvm/rubies/ruby-2.6.3/bin/irb
nowaker@nwkr-desktop ~/projekty/dreamhost % file /usr/bin/irb
/usr/bin/irb: Ruby script, ASCII text executable
nowaker@nwkr-desktop ~/projekty/dreamhost % pacman -Ql ruby-irb | grep bin
ruby-irb /usr/bin/
ruby-irb /usr/bin/irb

System IRB is in /usr/bin. Related: https://github.com/Linuxbrew/brew/issues/931. Two solutions offered there are:

  • brew vendor-install ruby

    • This works.

  • sudo pacman -Syu ruby-irb

    • This one does not work. ruby-irb is installed, as seen above, brew won't use it though, and will ignore the RVM-provided irb.

Expected: brew should Just Work :tm: - it should not get confused by RVM's irb in $PATH.


brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: python is symlinked to python3
This will confuse build scripts and in general lead to subtle breakage.

Warning: "config" scripts exist outside your system or Homebrew directories.
./configure scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
(... list here, irrelevant)

Warning: Your Homebrew's prefix is not /home/linuxbrew/.linuxbrew.
Some of Homebrew's bottles (binary packages) can only be used with the default
prefix (/home/linuxbrew/.linuxbrew).
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Discourse, Twitter or IRC. You are responsible for resolving any issues you
experience, as you are running this unsupported configuration.


brew config after vendor-install ruby

nowaker@nwkr-desktop ~/projekty/dreamhost % brew config
HOMEBREW_VERSION: 2.1.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 4025eadc2c3b9b71aa7029d7ddc6ede1cb88d482
Last commit: 10 days ago
Core tap ORIGIN: https://github.com/Homebrew/linuxbrew-core
Core tap HEAD: e7f435d6b24ca9a60d821f306081cf7386eeb0db
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /home/nowaker/.linuxbrew
HOMEBREW_CELLAR: /home/nowaker/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/nowaker/.cache/Homebrew
HOMEBREW_LOGS: /home/nowaker/.cache/Homebrew/Logs
HOMEBREW_REPOSITORY: /home/nowaker/.linuxbrew/Homebrew
HOMEBREW_NO_ANALYTICS: 1
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.7 => /home/nowaker/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 8.0 build 800
Git: 2.21.0 => /bin/git
Curl: 7.64.1 => /usr/bin/curl
Kernel: Linux 5.0.13-arch1-1-ARCH x86_64 GNU/Linux
OS: Arch Linux (n/a)
Host glibc: 2.29
/usr/bin/gcc: 8.3.0
glibc: N/A
gcc: N/A
xorg: N/A

Sorry, I dont have brew config before brew vendor-install ruby, and vendor-uninstall doesn't exist.

outdated

Most helpful comment

Having same issue on manjaro. Installing ruby-irb doesn't solve the problem.

All 9 comments

I couldn't reproduce this in Docker. Can you try running brew update-reset and see if you get the same issues, and if so, try to get a string of commands that I could run in a Docker container? Thanks

docker run -it archlinux/base

## inside docker
pacman -Syu tar procps-ng git base-devel
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

useradd linuxbrew
echo 'linuxbrew   ALL=(ALL) ALL' >> /etc/sudoers
echo 'Defaults:linuxbrew      !authenticate' >> /etc/sudoers
su - linuxbrew

curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install 2.6
rvm use 2.6

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
brew update
brew install hello

@jonchang Sure thing. Can you help with reverting brew vendor-install ruby first? I want to see the error on my daily Arch back, and then can try recreating in Docker. BTW - AFAIR, brew install worked with RVM just fine, it was brew upgrade that did not (and maybe only limited when there's something to actually upgrade - not sure about that).

Try rm -rf $(brew --repo)/Library/Homebrew/vendor/portable-ruby

Closing as this is a user setup issue.

Having same issue on manjaro. Installing ruby-irb doesn't solve the problem.

https://github.com/Linuxbrew/brew/blob/93389fde63974f096156344e281610acec44130c/bin/brew#L77

I am using RVM, just commented the line above. Works like a charm.

@MikeMcQuaid Can you please reopen? There's too many "me toos" and upvotes to blame "user setup issue" for it. BTW - I was not able to reproduce it in Docker.

@Nowaker No, sorry. It's still a user setup issue if it affects more than one person. We'll consider a pull request to address it.

@MikeMcQuaid @jonchang try:
```
docker run -it archlinux/base

inside docker

pacman -Syu tar procps-ng git base-devel ruby-irb
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

useradd linuxbrew
echo 'linuxbrew ALL=(ALL) ALL' >> /etc/sudoers
echo 'Defaults:linuxbrew !authenticate' >> /etc/sudoers
su - linuxbrew

sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
brew update
brew install hello```

You will see it does not work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fooness picture fooness  路  4Comments

vitahlin picture vitahlin  路  4Comments

paanvaannd picture paanvaannd  路  4Comments

DomT4 picture DomT4  路  3Comments

VagelisD picture VagelisD  路  3Comments