Homebrew-core: Homebrew macvim will not run after Sierra Security Update

Created on 2 Nov 2018  Â·  11Comments  Â·  Source: Homebrew/homebrew-core

  • [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
  • [ ] have a problem with brew install (or upgrade, reinstall) a single, official formula (not cask)? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/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 gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
    $ brew gist-logs macvim
    https://gist.github.com/a5b31f056914bca8346c18edd0244a69

  • [x] if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)

I was trying to run macvim from the command line via the gvim shell script.

  • What happened (include command output)

$ gvim
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
Referenced from: /usr/local/Cellar/macvim/8.1-151/MacVim.app/Contents/bin/…/MacOS/Vim
Reason: image not found
Abort

  • What you expected to happen

I expected macvim to launch as it normally does.

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

brew install macvim (I've also done a brew reinstall macvim and vim)
Then run /usr/local/bin/gvim.

Note that my PATH is:
/Users/willf/bin:/usr/local/bin:/usr/local/sbin:/usr/local/MacGPG2/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11/bin

$ type gvim
gvim is a tracked alias for /usr/local/bin/gvim

$ brew gist-logs macvim
https://gist.github.com/a5b31f056914bca8346c18edd0244a69

$ brew doctor
Your system is ready to brew.

$ brew config
HOMEBREW_VERSION: 1.8.1
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 422257067cc46d86138baa0e8e453348c2829cee
Last commit: 4 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: bfe0d507a7c13120bff3aa3d05aee131bd905f1d
Core tap last commit: 46 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_GITHUB_API_TOKEN: set
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 9.0 build 900
Git: 2.14.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_25
macOS: 10.12.6-x86_64
CLT: 9.2.0.0.1.1510905681
Xcode: 9.2
XQuartz: 2.7.11 => /opt/X11

More detail:

After I updated my Mini running Sierra (there are reasons I have not updated the OS on that system) with the latest Security update from Apple, the homebrew version of macvim (and gvim, etc…) became unable to run giving this error:

$ gvim
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
Referenced from: /usr/local/Cellar/macvim/8.1-151/MacVim.app/Contents/bin/…/MacOS/Vim
Reason: image not found
Abort

I have checked /System/Library/Frameworks/Ruby.framework/Versions and there is now a 2.3 folder which contains the ruby binary unlike the 2.0 folder. Looking at a Time Machine backup of the Versions folder I see that 2.3 was introduced by the security update.

As an aside, there is also a Current symlink in Versions that points to the most recent version of Ruby, so I’m wondering if it is possible to compile macvim to use that symlink instead of specifying the version of ruby to use? Or use the homebrew variant of ruby?

outdated stale

Most helpful comment

@wfiveash well, I had the same problem.
Idk about the correct solution, so will wait for the formulae update.
As a temporary solution, I got the working macvim by using Ruby from the current PATH:

brew install --env=std -v macvim

All 11 comments

@wfiveash well, I had the same problem.
Idk about the correct solution, so will wait for the formulae update.
As a temporary solution, I got the working macvim by using Ruby from the current PATH:

brew install --env=std -v macvim

@wfiveash Please fill out the issue template. Specifically please provide your brew doctor and brew config output.

Should I add the issue template info to this issue thread or should I create a new issue/bug report?

@wfiveash Please edit your original issue to use the template, thanks!

Not sure that this is a "proper" fix, but when I dug into the specific error message, I realized that my Homebrew Ruby version had updated to 2.5. So I got MacVim to start running again by just installing & linking Ruby 2.0:

$ ls /usr/local/lib/libruby.*
libruby.2.5.3.dylib  libruby.2.5.dylib    libruby.dylib
$ brew install [email protected]
$ brew link --overwrite --force [email protected]
$ ls /usr/local/lib/libruby.*
/usr/local/lib/libruby.2.0.0-static.a /usr/local/lib/libruby.2.0.dylib      /usr/local/lib/libruby.2.5.dylib
/usr/local/lib/libruby.2.0.0.dylib    /usr/local/lib/libruby.2.5.3.dylib    /usr/local/lib/libruby.dylib

I'm confused; I thought the problem was with the macOS native version of ruby changing to version 2.3 and I also thought that homebrew ruby installed everything under /usr/local and the homebrew macvim appears to have a runtime dependency on /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib which I assume is the native version not installed by homebrew. If I am mistaken please enlighten me.

BTW, the non-homebrew MacVim app from https://github.com/macvim-dev/macvim/releases/tag/snapshot-151 does run on my system.

And I just tried "brew upgrade" and saw this regarding macvim:

==> Reinstalling 1 broken dependent from source:
macvim
==> Reinstalling macvim
==> Downloading https://github.com/macvim-dev/macvim/archive/snapshot-151.tar.gz
Already downloaded: /Users/willf/Library/Caches/Homebrew/downloads/a77c5747e2df56420e5087b5fdb97882fa6d3e5fdeb6bcf5665257050312ca7b--macvim-snapshot-151.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --enable-ter
==> make
Last 15 lines from /Users/willf/Library/Logs/Homebrew/macvim/02.make:
clang -c -I. -g -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_perl.o auto/if_perl.c
clang -c -I. -g -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_perlsfio.o if_perlsfio.c
clang -c -I. -I/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -fPIE -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_python3.o if_python3.c
clang -c -I. -I/System/Library/Frameworks/Tcl.framework/Headers -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1 -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_tcl.o if_tcl.c
clang -c -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0 -DRUBY_VERSION=23 -DRUBY_VERSION=23 -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/if_ruby.o if_ruby.c
In file included from if_ruby.c:125:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found

include "ruby/config.h"

     ^~~~~~~~~~~~~~~

clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -o objects/netbeans.o netbeans.c
1 error generated.
make[1]: * [objects/if_ruby.o] Error 1
make[1]:
Waiting for unfinished jobs....
make: *
* [first] Error 2

READ THIS: https://docs.brew.sh/Troubleshooting

These open issues may also help:
Macvim install fails on MacOS 10.14 https://github.com/Homebrew/homebrew-core/issues/32464
Homebrew macvim will not run after Sierra Security Update https://github.com/Homebrew/homebrew-core/issues/33656

I do not see any config.h under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby however I do find it under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/Headers/ruby.

I'm wondering if Apple introduced a bug here.

@wfiveash :man_shrugging:

$ mv /usr/local/lib/libruby.2.0.0.dylib{,.bak}
$ mvim --version
dyld: Library not loaded: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib
  Referenced from: /usr/local/Cellar/macvim/8.1-151/MacVim.app/Contents/bin/../MacOS/Vim
  Reason: image not found
Abort trap: 6
$ mv /usr/local/lib/libruby.2.0.0.dylib{.bak,}
$ mvim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Aug 15 2018 18:27:39)
macOS version
Included patches: 1-280
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    +tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
+autochdir         +float             +mouse_xterm       +terminal
-autoservername    +folding           +multi_byte        +terminfo
+balloon_eval      -footer            +multi_lang        +termresponse
+balloon_eval_term +fork()            -mzscheme          +textobjects
+browse            +fullscreen        +netbeans_intg     +timers
++builtin_terms    -gettext           +num64             +title
+byte_offset       -hangul_input      +odbeditor         +toolbar
+channel           +iconv             +packages          +transparency
+cindent           +insert_expand     +path_extra        +user_commands
+clientserver      +job               +perl              +vartabs
+clipboard         +jumplist          +persistent_undo   +vertsplit
+cmdline_compl     +keymap            +postscript        +virtualedit
+cmdline_hist      +lambda            +printer           +visual
+cmdline_info      +langmap           +profile           +visualextra
+comments          +libcall           -python            +viminfo
+conceal           +linebreak         +python3           +vreplace
+cryptv            +lispindent        +quickfix          +wildignore
+cscope            +listcmds          +reltime           +wildmenu
+cursorbind        +localmap          +rightleft         +windows
+cursorshape       -lua               +ruby              +writebackup
+dialog_con_gui    +menu              +scrollbind        -X11
+diff              +mksession         +signs             -xfontset
+digraphs          +modify_fname      +smartindent       +xim
+dnd               +mouse             +startuptime       -xpm
-ebcdic            +mouseshape        +statusline        -xsmp
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_clipboard
+eval              -mouse_gpm         +syntax            -xterm_save
+ex_extra          -mouse_jsbterm     +tag_binary
+extra_search      +mouse_netterm     +tag_old_static
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby

I don't really know what's up, but those are my results. Of note is that the /System path from the error message doesn't exist regardless:

$ ls /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/
ruby

Maybe I reinstalled macvim in a weird way while trying the --env=std flag suggested previously in this thread?

@wfiveash - thanks!

I do not see any config.h under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby however I do find it under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/Headers/ruby.

I found config.h in a subfolder under where the installer expected to find it, as the only file in a folder called universal-darwin17, as if someone from apple didn't manage to copy it out when they copied the rest of the files to the correct location (just a guess). Copying the file to where the installer expects to find it causes a successful build

I just upgraded my macOS to Mojave and this issue went away. I will leave this issue open here in case others are affected.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yuna9 picture yuna9  Â·  4Comments

ghost picture ghost  Â·  3Comments

dredmorbius picture dredmorbius  Â·  3Comments

Steffen911 picture Steffen911  Â·  3Comments

jakepetroules picture jakepetroules  Â·  3Comments