Skip to content

Launching MacVim.app shows no window; mvim at shell launches but cannot open new windows #109

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

Closed
mattnworb opened this issue Nov 4, 2015 · 33 comments

Comments

@mattnworb
Copy link

This is a similar problem to #24.

At some point recently for me, opening Macvim via /Applications/MacVim.app no longer works. I initially installed MacVim via homebrew (with a simple brew install macvim and brew linkapps macvim). I've been having this issue before installing El Capitan.

Opening MacVim via mvim at the shell works, although note that this launches exec /usr/local/Cellar/macvim/7.4-79/MacVim.app/Contents/MacOS/Vim -g as opposed to exec /usr/local/Cellar/macvim/7.4-79/MacVim.app/Contents/MacOS/MacVim. However opening a new editor window in this launched MacVim with command-N or any other command does not work.

:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov  4 2015 12:55:10)
MacOS X (unix) version
Included patches: 1-903
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +clipboard       +cursorshape     +extra_search    -gettext         +lispindent      +mouse_dec       +multi_lang      +profile         +smartindent     -tcl             +virtualedit     -X11
+arabic          +cmdline_compl   +dialog_con_gui  +farsi           -hangul_input    +listcmds        -mouse_gpm       -mzscheme        +python          -sniff           +terminfo        +visual          -xfontset
+autocmd         +cmdline_hist    +diff            +file_in_path    +iconv           +localmap        -mouse_jsbterm   +netbeans_intg   -python3         +startuptime     +termresponse    +visualextra     +xim
+balloon_eval    +cmdline_info    +digraphs        +find_in_path    +insert_expand   -lua             +mouse_netterm   +odbeditor       +quickfix        +statusline      +textobjects     +viminfo         -xsmp
+browse          +comments        +dnd             +float           +jumplist        +menu            +mouse_sgr       +path_extra      +reltime         -sun_workshop    +title           +vreplace        -xterm_clipboard
++builtin_terms  +conceal         -ebcdic          +folding         +keymap          +mksession       -mouse_sysmouse  +perl            +rightleft       +syntax          +toolbar         +wildignore      -xterm_save
+byte_offset     +cryptv          +emacs_tags      -footer          +langmap         +modify_fname    +mouse_urxvt     +persistent_undo +ruby            +tag_binary      +transparency    +wildmenu        -xpm
+cindent         +cscope          +eval            +fork()          +libcall         +mouse           +mouse_xterm     +postscript      +scrollbind      +tag_old_static  +user_commands   +windows
+clientserver    +cursorbind      +ex_extra        +fullscreen      +linebreak       +mouseshape      +multi_byte      +printer         +signs           -tag_any_white   +vertsplit       +writebackup
   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"
    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_UNIX  -F/usr/local/Cellar/python/2.7.10_2/Frameworks -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include
/python2.7 -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/D
eveloper/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib -F/usr/local/Cellar/python/2.7.10_2/Frameworks -L/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -framework CoreFoundation -Wl,-sy
slibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.11 -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework Cocoa   -fstac
k-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl -F/usr/local/Cellar/python/2.7.10_2/Frameworks -framework Python   -framework Ruby

I've also done defaults delete org.vim.MacVim as mentioned in #66 but this has no effect for me.

@mattnworb
Copy link
Author

I've also tried Snapshot 80 from https://github.com/macvim-dev/macvim/releases but to no avail. Any advice on how to troubleshoot would be greatly appreciated 😄

When I try to launch MacVim.app I see these messages in Console.app

11/4/15 1:07:32.244 PM MacVim[65682]: [default] Failed to updated bookmark for item (null) [AB4B762B-349E-4344-9AE0-A7609A3ED9E3] - URL:file:///Users/mattbrown/code/helios/20151021T131155.335-com.spotify.helios.system.MasterAuthenticationTest_basicAuthentication-61321.log with error Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
11/4/15 1:07:32.245 PM MacVim[65682]: -[SFLListItem synthesizeMissingPropertyValues] Failed to updated bookmark for item (null) [AB4B762B-349E-4344-9AE0-A7609A3ED9E3] - URL:file:///Users/mattbrown/code/helios/20151021T131155.335-com.spotify.helios.system.MasterAuthenticationTest_basicAuthentication-61321.log with error Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
11/4/15 1:07:32.249 PM MacVim[65682]: [default] Failed to updated bookmark for item (null) [AB4B762B-349E-4344-9AE0-A7609A3ED9E3] - URL:file:///Users/mattbrown/code/helios/20151021T131155.335-com.spotify.helios.system.MasterAuthenticationTest_basicAuthentication-61321.log with error Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
11/4/15 1:07:32.249 PM MacVim[65682]: -[SFLListItem synthesizeMissingPropertyValues] Failed to updated bookmark for item (null) [AB4B762B-349E-4344-9AE0-A7609A3ED9E3] - URL:file:///Users/mattbrown/code/helios/20151021T131155.335-com.spotify.helios.system.MasterAuthenticationTest_basicAuthentication-61321.log with error Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist."
11/4/15 1:07:36.507 PM launchservicesd[84]: SecTaskLoadEntitlements failed error=22
11/4/15 1:07:36.614 PM launchservicesd[84]: SecTaskLoadEntitlements failed error=22

I am not sure if the last two are related but I do see them consistently ~2 seconds after messages from MacVim on each attempt at launching MacVim.app.

@snusmu
Copy link

snusmu commented Nov 6, 2015

i have exact same issue. i had it on yosemite and now have it on el capitan as well.
i tried reinstalling vim completely with brew, and tried latest snapshot.
i also tried removing everything related to macvim from /Users/snusmu/Library/Preferences/

@snusmu
Copy link

snusmu commented Nov 6, 2015

to clarify i tried snapshot 81 and brew version.
if i try to run /Applications/MacVim.app/Contents/MacOs/MacVim manually in the console, it does the same, no output at all, cannot open any editor windows, but can open Settings menu, and can open File->Open menu, and it shows Recent files too. but no editor window ever opens.
vim in command line works perfectly fine.

@eirnym
Copy link
Contributor

eirnym commented Nov 6, 2015

Confirm, no exceptions, no windows. I have to reactivate MacVim to be able to open any windows.

configuration doesn't matter (I've tried all combinations)

@mattnworb
Copy link
Author

In attempting to run MacVim.app through dtruss, I discovered that for me

$ /Applications/MacVim.app/Contents/MacOS/MacVim 

has the problematic behavior but if ran as another user (for instance, root)

$ sudo /Applications/MacVim.app/Contents/MacOS/MacVim 

windows open as expected.

@snusmu
Copy link

snusmu commented Nov 6, 2015

i tried starting it with sudo and it worked for me as well.
so i tried looking for some cache files vim might have in ~/Library/Caches but didnt find any
then i tried starting it without ~/.vim and ~/.vimrc, didnt start
tried wiping out all files in /tmp/ folder, didnt start
lost hope, switched to another task which required restart.
after restart, surprisingly, it started working without sudo
even though it didnt work for last 2 months for me

@mattnworb
Copy link
Author

A restart works for me as well 😕

@splhack
Copy link
Contributor

splhack commented Nov 7, 2015

So rebooting OS X solved the issue, right?

@snusmu
Copy link

snusmu commented Nov 7, 2015

If I understand correctly, first running binary with sudo, then rebooting
I'm not sure that just rebooting solves this issue
On lau., 7. nóv. 2015 at 05:57, Kazuki Sakamoto [email protected]
wrote:

So rebooting OS X solved the issue, right?


Reply to this email directly or view it on GitHub
#109 (comment).

@mattnworb
Copy link
Author

I don't think that running the binary with sudo changed or fixed anything as the problem still existed afterwards until rebooting; it was just a troubleshooting step along the way.

@splhack
Copy link
Contributor

splhack commented Nov 7, 2015

Anyone has the issue right now? I can't reproduce it, but it sounds like there is old Vim process aside from the new MacVim/Vim process. So if you had the same issue, to confirm there are no Vim processes using 'ps auxww' or Activity Monitor.

@mattnworb
Copy link
Author

@splhack I did notice when I was having the issue that I had a MacVim process still running (looked like the full command was sudo -u myusername /path/to/MacVim), although I thought at the time pre-reboot that it might have been spawned by some investigation I was trying to do with dtruss.

Interestingly the process seemed to be unkillable, kill, kill -9, kill -15 etc did not terminate it.

@splhack
Copy link
Contributor

splhack commented Nov 8, 2015

It sounds like the Vim process was zombie process, or the Vim process got I/O error. It should be checked using ps auxww|grep -i vim. And all we need to know is how to reproduce the issue.

@snusmu
Copy link

snusmu commented Nov 8, 2015

i managed to reproduce this issue.
on my machine, macvim wont start properly if i docker vm is up.
i tried following several times:

  1. quit macvim
  2. run "docker-machine start default"
  3. open macvim: doesnt open new editor windows.
  4. quit macvim
  5. run "docker-machine stop default"
  6. open macvim: works properly!

@snusmu
Copy link

snusmu commented Nov 8, 2015

actually, this even happens without quitting it.

  1. open macvim app with docker off: works properly.
  2. run "docker-machine start default": editor windows now stop opening in macvim
  3. run "docker-machine stop default": macvim starts working properly again

@mattnworb
Copy link
Author

I am also using docker-machine and I've found that starting a VM with it also re-causes this problem. My docker VM is using the VirtualBox driver, and it seems like if I create the VM with VMWare Fusion instead then I do not have an issue.

Stopping the docker VM running with VirtualBox also causes MacVim to work as expected for me as well.

Does MacVim or Vim expect to connect to anything on the host on tcp port 2376? docker-machine sets up the VMs to listen on this port, on a private IP (chosen from CIDR 192.168.99.1/24) host-only network interface. The IPs handed out to VMWare Fusion VMs seem to be on a different range, 192.168.116.1/24.

@cgbaker
Copy link

cgbaker commented Nov 9, 2015

Just discovered this thread after noticing that macvim had stopped working. The advice here is spot on; I'm using docker-machine with virtualbox, and stopping my VM allows macvim to work again.

@splhack
Copy link
Contributor

splhack commented Nov 14, 2015

How to reproduce it?

$ killall Vim
No matching processes belonging to you were found
$ killall MacVim
No matching processes belonging to you were found
$ defaults delete org.vim.MacVim

$ docker-machine ls           
NAME      ACTIVE   DRIVER       STATE     URL   SWARM
default   -        virtualbox   Stopped     

$ docker-machine start default
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM
default   *        virtualbox   Running   tcp://192.168.99.100:2376   

$ /Applications/MacVim.app/Contents/MacOS/Vim -g -u NONE -U NONE

MacVim works fine for me.

@snusmu
Copy link

snusmu commented Nov 16, 2015

well this line works (as mattnworb established in the first post):

$ /Applications/MacVim.app/Contents/MacOS/Vim -g -u NONE -U NONE

but starting MacVim in gui (clicking it in dock) doesnt work.

@snusmu
Copy link

snusmu commented Nov 16, 2015

and (also, as established in issue's name) after launching this:

 $ /Applications/MacVim.app/Contents/MacOS/Vim -g -u NONE -U NONE

new windows dont open (File->New window menu item doesnt do anything)

@splhack
Copy link
Contributor

splhack commented Nov 17, 2015

Ok, I guess I found out.

https://groups.google.com/d/msg/vim_mac/kPo414xEHmk/eddzYMlpAgYJ

Turns out I had a circular logic in my .bashrc that was causing it to
hang whenever I ran bash

So changing the default setting will solve the issue.

$ defaults write org.vim.MacVim MMLoginShell -bool NO

@splhack
Copy link
Contributor

splhack commented Nov 17, 2015

If you have this issue, you should verify your login shell environment.

  • 'SHELL' environment variable is correct? (no 'SHELL' set is totally ok)
  • login shell does work properly? for example 'bash -l' does work?

@splhack splhack closed this as completed Nov 17, 2015
@snusmu
Copy link

snusmu commented Nov 17, 2015

yes, this command solves issue for me:

defaults write org.vim.MacVim MMLoginShell -bool NO

but i didnt have any circular logic in shell

$ echo $SHELL
/bin/bash
$ bash -l
$

i tried removing everything from my bashrc/bashprofile
thing which stops macvim from working properly is this line in .bash_profile:

  eval "$(docker-machine env default)"

this is simple eval, resulting in:

 export DOCKER_TLS_VERIFY="1"
 export DOCKER_HOST="tcp://192.168.99.100:2376"
 export DOCKER_CERT_PATH="/Users/pavelkrasnovskij/.docker/machine/machines/default"
 export DOCKER_MACHINE_NAME="default"
 # Run this command to configure your shell:
 # eval "$(docker-machine env default)"

@snusmu
Copy link

snusmu commented Nov 17, 2015

oh all right, now i understood.

.bash_profile is for non interactive shells (http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html), so each eval command re-executes it. so it is circular logic.

but on os x .bash_profile is used instead of .bashrc on interactive shell start, so people who work in terminal tend to put things there.

Thank you @splhack for figuring this out. it was not macvim issue.

@jsfranko
Copy link

jsfranko commented Jun 5, 2016

Typing gvim after a brew install MacVim (7.4 as of this post) opens MacVim and shows an icon in the macOS dock. right click it and choose options and keep in dock. it also shows up in the context menu right clicking a file in the finder. you an also drag a doc to the icon in the dock. I removed the Vim.app that was installed in the applications folder. it crashed after bouncing a few times in the dock. vim at the command line opens a shell vim.

@jtianling
Copy link

defaults write org.vim.MacVim MMLoginShell -bool NO

works for me, thanks.

@NoShill
Copy link

NoShill commented Mar 27, 2018

I found a solution on my MBPro running macOS High Sierra 10.3.3. The MacVim installed on my machine expected Perl 5.16 and Ruby 2.0. With High Sierra, the versions are Perl 5.18 and Ruby 2.0.

What I did was open a terminal, change directory to /Applications/MacVim.app/Contents/MacOS
At the command line prompt, run ./Vim
It will give an error message about the libperl.dylib it couldn't find. In my case /System/Library/Perl/5.16/darwin-thread-multi-2level/CORE/libperl.dylib.
Edit Vim to put the correct version number in:
vi -b Vim
/Perl.5.16
Change the 6 to an 8 (for Perl 5.18) and save the file.

Run ./Vim again, and get an error message about which Ruby dylib it couldn't find. In my case, it was looking for 2.0, and 2.0.0. I edited Vim as above, found the string for Ruby 2.0, changed it to 2.3, and the 2.0.0 to 2.3.0 and saved Vim.

Now, MacVim opens a window just like it did before.

@sebtrif
Copy link

sebtrif commented Jun 13, 2018

@splhack nailed it for me! For the record, i had a lot of zombie MacVim/Vim processes left in the background. Once I stopped them everything returned to normal and I was able to get back into MacVim 👍

@wxing3
Copy link

wxing3 commented Sep 11, 2018

@NoShill Your solution works for me! It seemed like that Vim did not update when the build-in perl and ruby got updated in the MacOS.

@eirnym
Copy link
Contributor

eirnym commented Sep 11, 2018

@w0i0c0o MacVim uses Perl 5.18 since snapshot 148 and Ruby 2.5 sinse snapshot 145.

@FrankDMartinez
Copy link

Sorry. I have tried following this thread but it is unclear what the solution is. Was anyone able to actually find the cause of the issue?

@eirnym
Copy link
Contributor

eirnym commented Jul 21, 2020

@FrankDMartinez Could you describe what you want to achieve and eventually open a new issue?

@eirnym
Copy link
Contributor

eirnym commented Jul 21, 2020

I'm asking as new issue form will ask a few important questions better to answer, also we'll be able answer it better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests