Install vim with python2 component

Hello,

By default, homebrew installs vim with a “python3” component but without a “python” component:

➜  stuff git:(master) ✗ /usr/local/Cellar/vim/8.2.0750/bin/vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled May 13 2020 16:28:14)
Версія macOS
Включені латки: 1-750
Скомпілював  Homebrew
Гігантська версія без GUI.
  Включені (+) або не включені (-) компоненти:
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl              +title
-clientserver      +job               +persistent_undo   -toolbar
+clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           -python            +visual
+conceal           +linebreak         +python3           +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua               +ruby              +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              -mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   системний vimrc: "$VIM/vimrc"
     vimrc користувача: "$HOME/.vimrc"
 другий vimrc користувача: "~/.vim/vimrc"
      exrc користувача: "$HOME/.exrc"
       файл defaults: "$VIMRUNTIME/defaults.vim"
  заміна для $VIM: "/usr/local/share/vim"
Скомпільовано: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Скомпоновано: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.14 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.30.2_1/lib/perl5/5.30.2/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8/config-3.8-darwin -lpython3.8 -framework CoreFoundation  -lruby.2.7

There was a GitHub issue https://github.com/Homebrew/homebrew-core/issues/28077 - the vim formula used to have an option --with-python@2 to install vim with the “python” component. Not anymore.

Is there a way to install vim via homebrew with the “python” component enabled?

Python 2 is EOL and therefore not available in Homebrew anymore. The best course of action would be to start using python 3. If that’s not possible you could make a copy of the vim formula, enable the correct build options and maintain it in a personal tap: https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap

1 Like