New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew install failed one time with "Homebrew must be run under Ruby 2.3!" on Ruby 2.4, now works fine #3299

Closed
bbugh opened this Issue Oct 10, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@bbugh

bbugh commented Oct 10, 2017

Running brew install colordiff gave me an error message related to #3240, but only once. I am running Ruby 2.4, but #3240 is checking for minor version less than 3. I'm not sure how I saw this error, as the code looks like it would allow for 2.4.

Below is the exact sequence of commands I used.

> brew install colordiff                                                                                       
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
==> Auto-updated Homebrew!
Updated 4 taps (beeftornado/rmtree, caskroom/cask, homebrew/core, homebrew/services).
==> New Formulae
abyss                    bwfmetaedit              duc                      landscaper               mecab-unidic-extended    ssh-vault
beast                    bzt                      dvanalyzer               libbitcoin-blockchain    msgpuck                  xmrig
bench                    clac                     fn                       libbitcoin-node          pdfpc                    ykman
bowtie2                  crc32c                   gdcm                     libbitcoin-server        precomp                  zim
==> Updated Formulae
abcmidi                       ejabberd                      hevea                         metaproxy                     redis@3.2
algernon                      elasticsearch                 hg-fast-export                metricbeat                    remake
allure                        elixir ✔                      hh                            micro                         reop
amazon-ecs-cli                elvish                        hledger                       mikutter                      rocksdb
angular-cli                   emscripten                    hopenpgp-tools                minimal-racket                rom-tools
ansible                       enigma                        hugo                          minisign                      root
ansible-lint                  erlang ✔                      hyper                         minizinc                      rswift
apache-arrow                  etcd                          hyperscan                     mkvtoolnix                    s-nail
apache-brooklyn-cli           etsh                          i3                            monit                         sbcl
apache-geode                  evince                        ibex                          mosquitto                     sdl2
apache-zeppelin               exa                           icdiff                        mpage                         selenium-server-standalone
apibuilder-cli                exact-image                   idutils                       mpg123 ✔                      serd
apktool                       exploitdb                     imagemagick ✔                 mpw                           shadowsocks-libev
app-engine-go-64              eye-d3                        imagemagick@6                 mutt                          shairport-sync
app-engine-java               faac                          imapsync                      mycli                         shfmt
arangodb                      faad2                         influxdb                      mypy                          siege
armadillo                     faas-cli                      influxdb@0.8                  ncmpc                         simple-obfs
artifactory                   fastd                         ios-sim                       nco                           sip ✔
aubio                         fb-client                     iozone                        ndpi                          snakemake
augeas                        fd                            ipfs                          neatvi                        snap-telemetry
autoconf-archive              fdroidserver                  ipython                       nedit                         snap7
avro-tools                    feh                           ipython@5                     neofetch                      snapcraft
aws-elasticbeanstalk          fibjs                         isync                         nexus                         sngrep
aws-sdk-cpp                   file-roller                   itstool                       nghttp2                       sourcery
awscli                        filebeat                      jenkins                       nifi                          sphinx-doc
azure-cli                     fio                           jfrog-cli-go                  ninja                         spigot
bandcamp-dl                   firebase-cli                  jhipster                      nnn                           sqlmap
baobab                        flow                          jose                          no-more-secrets               sqlparse
bartycrouch                   fluent-bit                    jsonnet                       node ✔                        ssh-copy-id
bash-preexec                  folly                         jsonschema2pojo               node@6                        sshguard
bazel                         fontconfig ✔                  kawa                          noti                          stone-soup
bear                          fonttools                     kerl                          nss                           stubby
bento4                        fox                           khal                          numpy                         submarine
binaryen                      freetds                       kibana                        nvi                           subversion
binutils                      fwup                          kitchen-sync                  offlineimap                   svtplay-dl
bison                         gauge                         knot                          open-mpi                      swfmill
bison@2.7                     gcviewer                      knot-resolver                 openal-soft                   swift
bit                           gdk-pixbuf ✔                  kops                          opencoarrays                  swiftformat
bitrise                       geographiclib                 kotlin                        openjpeg ✔                    swiftgen
blahtexml                     get_iplayer                   kpcli                         opensaml                      swiftlint
bluepill                      getdns                        kubernetes-cli                openssh                       swimat
bnd                           geth                          kubernetes-helm               openvpn                       sysdig
botan                         ghostscript                   laszip                        orientdb                      taisei
bower                         git ✔                         launch                        osc                           tarantool
brotli                        git-annex                     launchdns                     osm2pgsql                     tbb
buildifier                    git-ftp                       ldc                           osmfilter                     telegraf
bulk_extractor                git-lfs                       lean                          osquery                       teleport
bullet                        git-number                    lean-cli                      osrm-backend                  terraform
byobu                         gitbucket                     lego                          osxutils                      terragrunt
caddy                         giter8                        lftp                          ott                           testssl
caf                           gjs                           libav                         overmind                      texmath
camlp5                        glade                         libbitcoin                    p11-kit ✔                     tig
ccm                           glib ✔                        libbitcoin-explorer           packetbeat                    tmux
certbot                       glide                         libdap                        paket                         todolist
certstrap                     globus-toolkit                libfabric                     par2                          tomcat
cfr-decompiler                gmic                          libgphoto2                    parallel                      tomcat@7
cgal                          gnatsd                        libhdhomerun                  pazpar2                       tracebox
chapel                        gnupg-pkcs11-scd              libhttpseverywhere            pcap_dnsproxy                 ttyd
checkstyle                    go                            libmatroska                   pdf2svg                       twemcache
chromedriver ✔                go@1.4                        libmodplug                    pdfgrep                       twtxt
chronograf                    go@1.8                        libmtp                        pdftoedn                      typescript
cimg                          gobject-introspection ✔       libnatpmp                     pdftoipe                      ucommon
citus                         godep                         libofx                        pegtl                         vala ✔
clojure                       goenv                         libowfat                      perl ✔                        vapoursynth ✔
clojurescript                 goocanvas                     libphonenumber                pgcli ✔                       varnish
cmake                         googler                       libprotoident                 pgroonga                      vbindiff
coffeescript                  gopass                        libqalculate                  pilosa                        vdirsyncer
configen                      gphoto2                       libraw                        pioneer                       vim ✔
convox                        gprof2dot                     librem                        pktanon                       vim@7.4
coreutils ✔                   gpsd                          librsvg ✔                     planck                        vips
cppad                         gradle                        libshout                      pldebugger                    virtualpg
cppcheck                      grafana                       libsmi                        pmdmini                       vnu
curl                          grails                        libsodium                     ponyc                         vte3
cutter                        grib-api                      libspectre                    ponysay                       watchexec
cvs                           grip                          libtcod                       poppler ✔                     weechat
cython                        groonga                       libtensorflow                 postgis                       wireguard-tools
dbus                          grpc                          libuecc                       pqiv                          wxmaxima
dbxml                         gsmartcontrol                 libuv                         pre-commit                    x265
dc3dd                         gst-editing-services          libuvc                        presto                        xa
dcm2niix                      gst-libav                     libvirt                       prometheus                    xalan-c
diff-pdf                      gst-plugins-bad               libwebsockets                 protobuf-swift                xerces-c
diffoscope                    gst-plugins-base              libxlsxwriter                 pure-ftpd                     xml-security-c
digdag                        gst-plugins-good              libxml2                       pyenv                         xml-tooling-c
direnv                        gst-plugins-ugly              linkerd                       pyenv-virtualenv              xqilla
dnscrypt-proxy                gst-python                    links                         pygobject3                    xsd
dnscrypt-wrapper              gst-rtsp-server               logstalgia                    pypy                          xtensor
dnsmasq                       gst-validate                  logstash                      pypy3                         yarn
dnsviz                        gstreamer                     logtalk                       python ✔                      yle-dl
docfx                         gtk+3                         macosvpn                      python3 ✔                     youtube-dl ✔
docker                        gtk-doc                       macvim                        qbs                           zabbix
docker-completion             gtk-gnutella                  magic-wormhole                qemu                          zile
docker2aci                    gtkextra                      mame                          qrencode                      zorba
doitlive                      gtksourceview3                mariadb                       quantlib                      zsh
dshb                          gucharmap                     mariadb@10.1                  quex                          zstd
dspdfviewer                   gwt                           maxima                        r
dtc                           haxe                          mercurial                     rclone
dwarf                         help2man                      meson                         rcs
efl                           heroku ✔                      metabase                      redis ✔
==> Renamed Formulae
gitlab-ci-multi-runner -> gitlab-runner            httpd24 -> httpd                                   thrift@0.90 -> thrift@0.9
gnome-icon-theme -> adwaita-icon-theme             mobile-shell -> mosh
==> Deleted Formulae
elixirscript                          rexster                               rexster-console                       tcpurify

/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)

> ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

> brew update
Already up-to-date.

> brew install colordiff                                                                                       bbugh@Brians-MacBook-Pro
To restore the stashed changes to /usr/local/Homebrew run:
  'cd /usr/local/Homebrew && git stash pop'
==> Downloading https://homebrew.bintray.com/bottles/colordiff-1.0.18.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring colordiff-1.0.18.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/colordiff/1.0.18: 10 files, 58.1KB

Testing the same homebrew code that raised the error in irb, in the same folder.

2.4.0 :001 > # check ruby version before requiring any modules.
2.4.0 :002 >   RUBY_VERSION_SPLIT = RUBY_VERSION.split "."
 => ["2", "4", "0"] 
2.4.0 :003 > RUBY_X = RUBY_VERSION_SPLIT[0].to_i
 => 2 
2.4.0 :004 > RUBY_Y = RUBY_VERSION_SPLIT[1].to_i
 => 4 
2.4.0 :005 > if RUBY_X < 2 || (RUBY_X == 2 && RUBY_Y < 3)
2.4.0 :006?>     raise "Homebrew must be run under Ruby 2.3!"
2.4.0 :007?>   end
 => nil

Output of brew config

brew config
HOMEBREW_VERSION: 1.3.5
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 91ab116ace7f4f97d3440190463c93be9ec6d675
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a57a3704b4e7a8dcb311cf2309d485ad93d4977d
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 8.1 build 802
Git: 2.13.1 => /usr/local/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.26.0/bin/perl
Python: /usr/local/opt/python/libexec/bin/python => /usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /Users/bbugh/.rvm/rubies/ruby-2.4.0/bin/ruby
Java: 1.8.0_101
macOS: 10.12.6-x86_64
Xcode: 8.3.3
CLT: 9.0.0.0.1.1504363082
X11: 2.7.11 => /opt/X11
-----------------------

Output of 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 and just ignore them. Thanks!

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libwkhtmltox.0.12.4.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/wkhtmltox/image.h
  /usr/local/include/wkhtmltox/pdf.h

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  mono

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
  brew install gd graphviz libpq webp

Run `brew missing` for more details.

Please always follow these steps:

  • Confirmed this is a problem with running a brew command and not brew installing or the post-install behaviour of one or more formulae? If it's a formulae-specific problem please file this issue at the relevant tap e.g. for Homebrew/homebrew-core https://github.com/Homebrew/homebrew-core/issues/new
  • Ran brew update and retried your prior step? Unable to reproduce issue
  • Ran brew doctor, fixed all issues and retried your prior step? Unable to reproduce issue
  • Ran brew config and brew doctor and included their output with your issue?

@bbugh bbugh changed the title from brew install failed one time with "Homebrew must be run under Ruby 2.3!", now works fine to brew install failed one time with "Homebrew must be run under Ruby 2.3!" on Ruby 2.4, now works fine Oct 10, 2017

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 10, 2017

Member

I am running Ruby 2.4

Homebrew always uses the system Ruby, so it likely started with Ruby 2.0.0, installed the vendored Ruby 2.3.3, but then didn't use the vendored Ruby the first time.

Can you reproduce the error if you remove /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby?

Member

reitermarkus commented Oct 10, 2017

I am running Ruby 2.4

Homebrew always uses the system Ruby, so it likely started with Ruby 2.0.0, installed the vendored Ruby 2.3.3, but then didn't use the vendored Ruby the first time.

Can you reproduce the error if you remove /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby?

@stevenzeck

This comment has been minimized.

Show comment
Hide comment
@stevenzeck

stevenzeck Oct 11, 2017

Would this explain why Travis builds for OSX fail? https://travis-ci.org/szeck87/atom-beautify/jobs/286285106

stevenzeck commented Oct 11, 2017

Would this explain why Travis builds for OSX fail? https://travis-ci.org/szeck87/atom-beautify/jobs/286285106

@MariadeAnton

This comment has been minimized.

Show comment
Hide comment
@MariadeAnton

MariadeAnton Oct 11, 2017

Hi everyone! This is María from Travis CI -

As @szeck87 mentioned, we're seeing a similar behaviour in our macOS environment on macOS builds travis-ci/travis-ci#8552 (comment)

Seems that current workarounds would be:

  • removed
  • running brew update before brew install package_name

Does this help? Thank you!

MariadeAnton commented Oct 11, 2017

Hi everyone! This is María from Travis CI -

As @szeck87 mentioned, we're seeing a similar behaviour in our macOS environment on macOS builds travis-ci/travis-ci#8552 (comment)

Seems that current workarounds would be:

  • removed
  • running brew update before brew install package_name

Does this help? Thank you!

@reitermarkus

This comment has been minimized.

Show comment
Hide comment
@reitermarkus

reitermarkus Oct 11, 2017

Member

This was fixed in Homebrew 1.3.4, so if you are on >= 1.3.4 now, you can safely ignore this error. For Travis, refer to the workaround above.

Member

reitermarkus commented Oct 11, 2017

This was fixed in Homebrew 1.3.4, so if you are on >= 1.3.4 now, you can safely ignore this error. For Travis, refer to the workaround above.

@MikeMcQuaid

This comment has been minimized.

Show comment
Hide comment
@MikeMcQuaid

MikeMcQuaid Oct 11, 2017

Member

@MariadeAnton The better fix would be if Travis CI could prioritise updating the Homebrew on your base images (basically: run brew update, create a new image). I've removed one of your suggestions because we intentionally don't want people to just disable auto-updating because then they will never turn it back on and file bugs to us based on old Homebrew versions. Thanks!

Member

MikeMcQuaid commented Oct 11, 2017

@MariadeAnton The better fix would be if Travis CI could prioritise updating the Homebrew on your base images (basically: run brew update, create a new image). I've removed one of your suggestions because we intentionally don't want people to just disable auto-updating because then they will never turn it back on and file bugs to us based on old Homebrew versions. Thanks!

@MariadeAnton

This comment has been minimized.

Show comment
Hide comment
@MariadeAnton

MariadeAnton Oct 11, 2017

@MikeMcQuaid thank you for explaining - that makes sense!
These are workarounds while we update our long-term support macOS images, we'll stick to brew update in the meantime :)

MariadeAnton commented Oct 11, 2017

@MikeMcQuaid thank you for explaining - that makes sense!
These are workarounds while we update our long-term support macOS images, we'll stick to brew update in the meantime :)

@stevenzeck

This comment has been minimized.

Show comment
Hide comment
@stevenzeck

stevenzeck Oct 11, 2017

OK, running brew update before any installs worked. Not to sidetrack this issue, but @MariadeAnton is there an issue in https://github.com/travis-ci/travis-ci/ I can comment on about updating images? Updating Homebrew takes the longest and certainly doesn't help the number of backlog OSX builds, while updating the images frequently would reduce that significantly.

stevenzeck commented Oct 11, 2017

OK, running brew update before any installs worked. Not to sidetrack this issue, but @MariadeAnton is there an issue in https://github.com/travis-ci/travis-ci/ I can comment on about updating images? Updating Homebrew takes the longest and certainly doesn't help the number of backlog OSX builds, while updating the images frequently would reduce that significantly.

@StrikerRUS StrikerRUS referenced this issue Oct 12, 2017

Merged

fix osx test #977

andreas-bok-sociomantic added a commit to andreas-bok-sociomantic/libdrizzle-redux that referenced this issue Oct 13, 2017

Fix brew runtime error on travis
Homebrew requires Ruby 2.3 to run.
The Travis images for OSX are outdated,
and the only way to get Homebrew working is
to run brew update before doing anything else,
as suggested in
Homebrew/brew#3299

mathias-lang-sociomantic added a commit to sociomantic-tsunami/libdrizzle-redux that referenced this issue Oct 13, 2017

Fix brew runtime error on travis
Homebrew requires Ruby 2.3 to run.
The Travis images for OSX are outdated,
and the only way to get Homebrew working is
to run brew update before doing anything else,
as suggested in
Homebrew/brew#3299

qmfrederik added a commit to qmfrederik/ffmpeg-win32 that referenced this issue Oct 15, 2017

@JCount

This comment has been minimized.

Show comment
Hide comment
@JCount

JCount Oct 15, 2017

Member

@javadba Could you please open a new issue and fill out the issue template as much as you can.

Member

JCount commented Oct 15, 2017

@javadba Could you please open a new issue and fill out the issue template as much as you can.

malb added a commit to fplll/fplll that referenced this issue Oct 16, 2017

JWorthe added a commit to JWorthe/rusty_microphone that referenced this issue Oct 16, 2017

Added 'brew update' to travisci macos build script
There's currently an error in the build on installing the dependencies
from homebrew. From the comments here
Homebrew/brew#3299, looks like this might
solve it.

@jdm jdm referenced this issue Oct 16, 2017

Closed

Fix macOS travisCI #124

leolorenzoluis added a commit to leolorenzoluis/Facebook that referenced this issue Oct 17, 2017

dextero added a commit to dextero/Anjay that referenced this issue Oct 17, 2017

dvarrazzo added a commit to psycopg/psycopg2-wheels that referenced this issue Oct 19, 2017

mtrmac added a commit to mtrmac/skopeo that referenced this issue Oct 19, 2017

Work around broken brew in Travis
Per Homebrew/brew#3299 , (brew update)
is needed to avoid a
> ==> Downloading https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
> ######################################################################## 100.0%
> ==> Pouring portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz
...
> /usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)

Ideally Travis should bake the (brew update) into its images
(travis-ci/travis-ci#8552 ), but that’s only going
to happen around November 2017 per https://blog.travis-ci.com/2017-10-16-a-new-default-os-x-image-is-coming .

Until then, we have to do that ourselves.

jhasse added a commit to jhasse/pwcalculator that referenced this issue Oct 23, 2017

jhasse added a commit to jhasse/jngl that referenced this issue Oct 23, 2017

jPhy added a commit to mppmu/secdec that referenced this issue Oct 23, 2017

nikolaykasyanov added a commit to flix-tech/danger-code_style_validation that referenced this issue Oct 31, 2017

Calls `brew update` explicitly on Travis
This is a workaround for the Ruby version issue.
See Homebrew/brew#3299 (comment).

hombit added a commit to matwey/fips3 that referenced this issue Oct 31, 2017

nikolaykasyanov added a commit to flix-tech/danger-code_style_validation that referenced this issue Oct 31, 2017

Fixes CI (#14)
* Disables old ruby versions from Travis testing matrix
* Calls `brew update` explicitly on Travis to workaround Travis/Homebrew issue

Fixes #13.



This is a workaround for the Ruby version issue.
See Homebrew/brew#3299 (comment).

@Homebrew Homebrew deleted a comment from dwanderton Nov 3, 2017

@Homebrew Homebrew locked and limited conversation to collaborators Nov 3, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.