Я удалил Ruby на своем Ма c, используя:
brew remove -f ruby
brew cleanup
Homebrew отобразил сообщение, что "Vim имеет Ruby зависимость, хочу ли я удалить Ruby (у / N) ", и я выбрал" y "и Ruby был удален.
Затем я установил Ruby снова с:
brew install ruby
После этого Vim начал выдавать мне ошибки при запуске:
vim .
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:17:in `require': incompatible library version - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/stringio.bundle (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:17:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:1230:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:1230:in `<module:Gem>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:116:in `<top (required)>'
from <internal:gem_prelude>:4:in `require'
from <internal:gem_prelude>:4:in `<internal:gem_prelude>'
Traceback (most recent call last):
File "<string>", line 9, in <module>
File "/Users/ruslan/.vim/bundle/powerline/powerline/__init__.py", line 11, in <module>
from powerline.lib.config import ConfigLoader
File "/Users/ruslan/.vim/bundle/powerline/powerline/lib/config.py", line 11, in <module>
from powerline.lib.threaded import MultiRunnedThread
File "/Users/ruslan/.vim/bundle/powerline/powerline/lib/threaded.py", line 7, in <module>
from powerline.lib.monotonic import monotonic
File "/Users/ruslan/.vim/bundle/powerline/powerline/lib/monotonic.py", line 19, in <module>
import ctypes
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 555, in <module>
_reset_cache()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 279, in _reset_cache
CFUNCTYPE(c_int)(lambda: None)
MemoryError
An error occurred while importing powerline module.
This could be caused by invalid sys.path setting,
or by an incompatible Python version (powerline requires
Python 2.6, 2.7 or 3.2 and later to work). Please consult
the troubleshooting section in the documentation for
possible solutions.
Error detected while processing /Users/ruslan/.vim/bundle/powerline/powerline/bindings/vim/plugin/powerline.vim:
line 157:
Traceback (most recent call last):
File "<string>", line 53, in <module>
File "<string>", line 9, in powerline_troubleshoot
File "/Users/ruslan/.vim/bundle/powerline/powerline/__init__.py", line 11, in <module>
from powerline.lib.config import ConfigLoader
File "/Users/ruslan/.vim/bundle/powerline/powerline/lib/config.py", line 11, in <module>
from powerline.lib.threaded import MultiRunnedThread
File "/Users/ruslan/.vim/bundle/powerline/powerline/lib/threaded.py", line 7, in <module>
from powerline.lib.monotonic import monotonic
File "/Users/ruslan/.vim/bundle/powerline/powerline/lib/monotonic.py", line 19, in <module>
import ctypes
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 555, in <module>
_reset_cache()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 279, in _reset_cache
CFUNCTYPE(c_int)(lambda: None)
MemoryError
Press ENTER or type command to continue
После этого я добавил следующие строки в ~ / .vimr c:
let $RUBYHOME=$HOME."~/.rbenv/versions/2.7.0"
set rubydll=$HOME/.rbenv/versions/2.7.0/lib/libruby.2.7.dylib
let g:powerline_pycmd = 'py3'
Сообщение об ошибке при запуске Vim изменилось на:
Error detected while processing /Users/ruslan/.vim/bundle/vim-rubyhash/plugin/rubyhash.vim:
line 54:
E370: Could not load library /Users/ruslan/.rbenv/versions/2.7.0/lib/libruby.2.7.dylib
E266: Sorry, this command is disabled, the Ruby library could not be loaded.
You need vim compiled with Python 2.6, 2.7 or 3.2 and later support
for Powerline to work. Please consult the documentation for more
details.
E370: Could not load library /Users/ruslan/.rbenv/versions/2.7.0/lib/libruby.2.7.dylib
E266: Sorry, this command is disabled, the Ruby library could not be loaded.
Press ENTER or type command to continue
Я также пытался:
brew uninstall vim ruby
brew cleanup
rbenv global system
brew install vim ruby
Но это не помогло.
Моя система:
macOS => Mojave
vim --version =>
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 19 2019 19:08:44)
Included patches: 1-503, 505-680, 682-1283, 1365
which vim => /usr/bin/vim
which ruby => /Users/myname/.rbenv/shims/ruby
ruby -v => ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
python3 --version => Python 3.7.7
Я не смог найти ни одного источники, помогающие решить эту проблему.