カテゴリー
Apple

【Mac】Homebrew での Vim インストール、アンインストール、使用開始設定の手順メモ

Homebrew での Vim インストールでのポイント

  • インストール後、ターミナルの再起動で使用できるようになる(または新しいタブで作業開始しても反映される)
  • 事前準備として Homebrew をアップデートしなくても、自動的に Auto-updated Homebrew! が実行された。
# 準備
brew update

# Homebrew を使った Vim インストール
# ターミナル再起動または新規タブでの利用でも反映される。
brew install vim

# パス設定を確認
which vim
# バージョン確認
vim --version

# Homebrew の Vim アンインストール
brew uninstall vim

デフォルトの Vim のバージョン

  • Vim 7.3
  • /usr/bin/vim
$ which vim
/usr/bin/vim
$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 14 2016 16:06:49)
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype 
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn 
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs 
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save 
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
$

Homebrew での Vim インストール時の出力

5分ほどかかったかしら。結構インストールに時間がかかり、依存するパッケージも少なくない、と感じましたわ。

$ brew install vim
==> Installing dependencies for vim: perl, libyaml, ruby, python
==> Installing vim dependency: perl
==> Downloading https://homebrew.bintray.com/bottles/perl-5.24.0_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring perl-5.24.0_1.el_capitan.bottle.tar.gz
==> Caveats
By default non-brewed cpan modules are installed to the Cellar. If you wish
for your modules to persist across updates we recommend using `local::lib`.

You can set that up like this:
  PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" cpan local::lib
  echo 'eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"' >> ~/.bash_profile
==> Summary
?  /usr/local/Cellar/perl/5.24.0_1: 2,291 files, 55.1M
==> Installing vim dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.6_1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.1.6_1.el_capitan.bottle.tar.gz
?  /usr/local/Cellar/libyaml/0.1.6_1: 8 files, 312.9K
==> Installing vim dependency: ruby
==> Downloading https://homebrew.bintray.com/bottles/ruby-2.3.1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring ruby-2.3.1.el_capitan.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/ruby
==> Summary
?  /usr/local/Cellar/ruby/2.3.1: 1,260 files, 19.0M
==> Installing vim dependency: python
Warning: Building python from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

==> Downloading https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
######################################################################## 100.0%
==> Downloading https://bugs.python.org/file30805/issue10910-workaround.txt
Already downloaded: /Users/oki2a24/Library/Caches/Homebrew/python--patch-c075353337f9ff3ccf8091693d278782fcdff62c113245d8de43c5c7acc57daf.txt
==> Patching
==> Applying issue10910-workaround.txt
patching file Include/pyport.h
Hunk #1 succeeded at 713 (offset 14 lines).
Hunk #2 succeeded at 736 (offset 14 lines).
==> ./configure --prefix=/usr/local/Cellar/python/2.7.12 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.12/share --datadir=/usr/lo
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.12
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.12/share/python
==> Downloading https://files.pythonhosted.org/packages/9f/7c/0a33c528164f1b7ff8cf0684cf88c2e733c8ae0119ceca4a3955c7fc059d/setuptools-23.1.0
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/c9/1d/bd19e691fd4cfe908c76c429fe6e4436c9e83583c4414b54f6c85471954a/wheel-0.29.0.tar.
######################################################################## 100.0%
==> /usr/local/Cellar/python/2.7.12/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --rec
==> /usr/local/Cellar/python/2.7.12/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --rec
==> /usr/local/Cellar/python/2.7.12/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --rec
==> Caveats
Pip and setuptools have been installed. To update them
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Homebrew-and-Python.md

.app bundles were installed.
Run `brew linkapps python` to symlink these to /Applications.
==> Summary
?  /usr/local/Cellar/python/2.7.12: 6,288 files, 85.3M, built in 4 minutes 2 seconds
==> Installing vim
==> Downloading https://homebrew.bintray.com/bottles/vim-7.4.2210.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring vim-7.4.2210.el_capitan.bottle.tar.gz
?  /usr/local/Cellar/vim/7.4.2210: 1,695 files, 23.2M
$

Homebrew でインストールした Vim のバージョン

  • Vim 7.4
  • /usr/local/bin/vim
$ which vim
/usr/local/bin/vim
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 14 2016 19:17:10)
MacOS X (unix) version
Included patches: 1-2210
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     -gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            +mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.11 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.24.0_1/lib/perl5/5.24.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/Cellar/python/2.7.12/Frameworks -framework Python   -lruby.2.3.0 -lobjc -L/usr/local/Cellar/ruby/2.3.1/lib    
$

おわりに。おまけとして、不要だったこと

参考ページに有りました、下記の内容は不要でした。

というよりも、そもそも .bashrc ファイルが存在しませんでした。.bash_profile ファイルはございます。そして、この .bash_profile フィアイルは .bashrc ファイルに相当するように思えてなりません。

# デフォルトの Vim ではなく、Homebrew の Vim を使うよう設定
# 次の 1 行を ~/.bashrc に追記
# export PATH="/usr/local/bin:$PATH"
# 設定を反映
source ~/.bashrc

以上です。

コメントを残す