lua付でMacにvimのインストール


インストール

$ brew install lua
$ brew install vim --with-lua

通常はこれで入るはず。
brew は別途インストールする必要があります。

その他オプションの確認

$ brew options vim
--with-client-server
    Enable client/server mode
--with-lua
    Build vim with lua support
--with-luajit
    Build with luajit support
--with-mzscheme
    Build vim with mzscheme support
--with-override-system-vi
    Override system vi
--with-python3
    Build vim with python3 instead of python[2] support
--with-tcl
    Build vim with tcl support
--without-nls
    Build vim without National Language Support (translated messages, keymaps)
--without-perl
    Build vim without perl support
--without-python
    Build vim without python support
--without-ruby
    Build vim without ruby support
--HEAD
    Install HEAD version

いろいろあったエラー

最終的には1番最初に書いた2行で済むはずですが、いくつかあったのでここに記録。

devel要らなかった

$ brew install vim --devel --with-lua
Error: No devel block is defined for vim

ruby/config.hがない

--devel を抜いて実行すると今度は ruby/config.h が無いというエラー

$ brew install vim --with-lua
==> Downloading https://github.com/vim/vim/archive/v7.4.1301.tar.gz
Already downloaded: /Library/Caches/Homebrew/vim-7.4.1301.tar.gz
==> ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/7.4.1301/share/man --enable-multibyte --with-tlib=ncu
==> make
Last 15 lines from /Users/takara/Library/Logs/Homebrew/vim/02.make:
/usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -I/usr/local/include -o objects/if_lua.o if_lua.c
/usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -g  -DPERL_DARWIN -fno-strict-aliasing -fstack-protector  -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE  -o objects/if_perl.o auto/if_perl.c
/usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -g  -DPERL_DARWIN -fno-strict-aliasing -fstack-protector  -I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE  -o objects/if_perlsfio.o if_perlsfio.c
/usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON_HOME='"/System/Library/Frameworks/Python.framework/Versions/2.7"' -fPIE  -o objects/if_python.o if_python.c
/usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -DRUBY_VERSION=20 -o objects/if_ruby.o if_ruby.c
/usr/bin/clang -c -I. -Iproto -DHAVE_CONFIG_H   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -DMACOS_X_UNIX  -Os -w -pipe -march=native -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       -o objects/netbeans.o netbeans.c
In file included from if_ruby.c:113:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
         ^
1 error generated.
make[1]: *** [objects/if_ruby.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [first] Error 2

READ THIS: https://git.io/brew-troubleshooting

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:353:in `open_http': 422 Unprocessable Entity (GitHub::Error)
Validation Failed
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:709:in `buffer_open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:210:in `block in open_loop'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:208:in `catch'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:208:in `open_loop'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:149:in `open_uri'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:689:in `open'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/open-uri.rb:30:in `open'
    from /usr/local/Library/Homebrew/utils.rb:523:in `open'
    from /usr/local/Library/Homebrew/utils.rb:554:in `issues_matching'
    from /usr/local/Library/Homebrew/utils.rb:586:in `issues_for_formula'
    from /usr/local/Library/Homebrew/exceptions.rb:222:in `fetch_issues'
    from /usr/local/Library/Homebrew/exceptions.rb:218:in `issues'
    from /usr/local/Library/Homebrew/exceptions.rb:263:in `dump'
    from /usr/local/Library/brew.rb:134:in `rescue in <main>'
    from /usr/local/Library/brew.rb:28:in `<main>'

brew を更新するが状況は変わらず。

$ brew update
==> Migrating Homebrew to v0.9.9
remote: Counting objects: 260, done.
remote: Compressing objects: 100% (213/213), done.
remote: Total 260 (delta 136), reused 122 (delta 33), pack-reused 0
Receiving objects: 100% (260/260), 430.20 KiB | 114.00 KiB/s, done.
Resolving deltas: 100% (136/136), completed with 134 local objects.
From https://github.com/Homebrew/brew
 + f0b70e5...9cf2710 master     -> origin/master  (forced update)
HEAD is now at 9cf2710 os/mac/*_mach: move shared code into 'SharedMachO' (#282)
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3706, done.
remote: Compressing objects: 100% (3588/3588), done.
remote: Total 3706 (delta 13), reused 2369 (delta 9), pack-reused 0
Receiving objects: 100% (3706/3706), 2.87 MiB | 245.00 KiB/s, done.
Resolving deltas: 100% (13/13), done.
Checking connectivity... done.
Tapped 3584 formulae (3,732 files, 8.9M)
Already up-to-date.

参考サイトを元にconfig.hのシンボリックリンクを作成

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby
$ sudo ln -s ../ruby/config.h ./config.h

注意:MacOSX10.11.sdkuniversal-darwin15 部分は数字が変わるので注意、フォルダが実際どうなっているか確認しましょう。

参考サイト