Solved the problem that MacVim installed by Homebrew was not built by python of pyenv

It's an ad hoc solution. I think the details are wrong, but for the time being, this worked, so I will summarize it. Please let me know if there is a good or correct method.

It is an article that saves those who are worried about such problems

MacVim installation instructions

Tap the macvim repository

brew install macvim only installs the pre-built one, so get the source code from the macvim repository and build and install it.

$ brew tap macvim-dev/macvim

Install pyenv Python with DLL

If you install normally with pyenv, the DLL required to build MacVim will not be created, so add the following environment variables and build. python3 gives an error such as -undefined dynamic_lookup is missing and pip install greenlet.

** Change the version number to the one you are using. ** **

PYTHON_CONFIGURE_OPTS="--enable-shared" \
    LDSHARED="clang -bundle" \
    LDCXXSHARED="clang++ -bundle" \
    BLDSHARED="clang -bundle -lpython2.7" \
    pyenv install 2.7.12

PYTHON_CONFIGURE_OPTS="--enable-shared" \
    LDSHARED="clang -undefined dynamic_lookup -bundle"\
    LDCXXSHARED="clang++ -undefined dynamic_lookup -bundle" \
    BLDSHARED="clang -bundle -undefined dynamic_lookup -lpython3.5m" \
    pyenv install 3.5.2

Change build settings with brew edit

Since the build argument is set in the source code, rewrite the source code with brew edit. (It took me a day to notice because I'm new to brew.)

$ brew edit macvim-dev/macvim/macvim

The Ruby code will be displayed, so change the def install at the top. The commented out part is the default value. Since you can only see Python3 installed by Homebrew, change the path to refer to Python3 of pyenv. Since python2 also tries to refer to the MacOS System library, add variables and paths so that python2 also refers to python2 in pyenv. ** Change the enushi part to your own username. ** **

  def install
    perl_version = '5.16'
    ENV.append 'VERSIONER_PERL_VERSION', perl_version
    ENV.append 'VERSIONER_PYTHON_VERSION', '2.7'
    ENV.append 'vi_cv_path_python', "/Users/enushi/.pyenv/versions/2.7.10/bin/python2"
    ENV.append 'vi_cv_path_python3', "/Users/enushi/.pyenv/versions/3.4.3/bin/python3"
    ENV.append 'vi_cv_path_plain_lua', "#{HOMEBREW_PREFIX}/bin/lua"
    ENV.append 'vi_cv_dll_name_perl', "/System/Library/Perl/#{perl_version}/darwin-thread-multi-2level/CORE/libperl.dylib"
    ENV.append 'vi_cv_dll_name_python3', "/Users/enushi/.pyenv/versions/3.4.3/lib/libpython3.4m.dylib"
    ENV.append 'vi_cv_dll_name_python', "/Users/enushi/.pyenv/versions/2.7.10/lib/libpython2.7.dylib"
    #ENV.append 'vi_cv_path_python3', "#{HOMEBREW_PREFIX}/bin/python3"
    #ENV.append 'vi_cv_path_plain_lua', "#{HOMEBREW_PREFIX}/bin/lua"
    #ENV.append 'vi_cv_dll_name_perl', "/System/Library/Perl/#{perl_version}/darwin-thread-multi-2level/CORE/libperl.dylib"
    #ENV.append 'vi_cv_dll_name_python3', "#{HOMEBREW_PREFIX}/Frameworks/Python.framework/Versions/3.5/Python"

Install MacVim

--with-properly-linked-python2-python3 is required. --with-override-system-vim is an option that replaces the default vim (vim running on the console) in the OS with mvim -v. Use it as you like.

brew install --HEAD --with-properly-linked-python2-python3 --with-override-system-vim macvim-dev/macvim/macvim

Confirmation after installation

Start mvim and execute the following command.

:python print(sys.path)
:py3 print(sys.path)

The output path should be pyenv's python. Also, if it can be executed continuously, the effect of --with-properly-linked-python2-python3 is obtained.

reference

Well then. Happy Vim Life

Recommended Posts

Solved the problem that MacVim installed by Homebrew was not built by python of pyenv
The story that the version of python 3.7.7 was not adapted to Heroku
Install the latest Python from pyenv installed with homebrew
Solved the problem that the image was not displayed in ROMol when loaded with PandasTools.LoadSDF.
I couldn't use tkinter with python installed by pyenv of anyenv
The story that the Homebrew environment was blown away when Anaconda was installed
Change the Python version of Homebrew
The problem that the version of Vue CLI did not go up
The 16th offline real-time how to write problem was solved with Python
The 15th offline real-time how to write problem was solved with python
Pandas of the beginner, by the beginner, for the beginner [Python]
The story that XGBoost was finally installed
I thought it was the same as python, and I was addicted to the problem that the ruby interpreter did not start.
It seems that the version of pyflakes is not the latest when flake8 is installed
I installed Pygame with Python 3.5.1 in the environment of pyenv on OS X
Solution to the problem that you can't activate by putting conda in pyenv
Examples and solutions that the Python version specified in pyenv does not run
Check the operation of OpenCV3 installed by Anaconda
2016 The University of Tokyo Mathematics Solved with Python
I solved the deepest problem of Hiroshi Yuki.
pyenv doesn't work with tcl-tk installed by homebrew.
About the matter that the contents of Python print are not visible in docker logs
[Python] A program that counts the number of valleys
Not being aware of the contents of the data in python
python chrome driver ver. Solving the problem of difference
The story that the return value of tape.gradient () was None
Note that one problem was solved when jupyter-notebook was introduced.
The attitude that programmers should have (The Zen of Python)
[Python] A program that compares the positions of kangaroos.
Use python installed with Pyenv with Sublime REPL of Sublime Text 3
A library that monitors the life and death of other machines by pinging from Python
__init__ called by wxPython or Tkinter was a __init__ call of the inheriting class in Python
A story that pyenv is stuck because the python execution command PATH does not pass
A memorandum (masOS) that import tkinter could not be done with python installed from pyenv