8

How can I change the compiler configuration when I use brew install? I want to compile vim with +farsi using brew. But it seems that +farsi is not available options in brew:

$ brew install +farsi vim
Error: No available formula for +farsi

I also tried this command:

$ brew install vim --+farsi
==> Downloading http://ftp.debian.org/debian/pool/main/v/vim/vim_7.4.052.orig.tar.gz
Already downloaded: /Library/Caches/Homebrew/vim-7.4.052.tar.gz
==> Patching
patching file src/auto/configure
patching file src/osdef.sh
patching file src/os_mac.h
==> ./configure --prefix=/usr/local --mandir=/usr/local/Cellar/vim/7.4.052/share/man --enable-multibyte --with-tlib=ncur
==> make
==> make install prefix=/usr/local/Cellar/vim/7.4.052 STRIP=/usr/bin/true

But still +farsi is not compiled with vim:

[ben@thebeast ~/vim/vim74]$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 24 2013 18:58:47)
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
-farsi

In fact the only options available are these:

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

Does this means that only subset of configurations are available in brew?

5
  1. brew install vim installs vim 7.4.052
  2. vim --version reports version 7.3

From above observation it is clearly apparent that these are two different vims. By executing vim --version you are invoking vim supplied as part of OS X (you can check this by which vim, which is going to report /usr/bin/vim, while brew-built programs are usually located under /usr/local directory.

To edit vim formula you just execute brew edit vim, yet you do not need to do this just to get your desired farsi support. As you can see from Vim Feature Table, farsi support is included with any build compiled with --with-features=big or huge. As brew builds are compiled with --with-features=huge, they already contain farsi support.

/usr/local/bin/vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 1 2014 14:31:50)
MacOS X (unix) version
Included patches: 1-52
Compiled by Homebrew
Huge version without GUI. Features included (+) or not (-):

+acl +farsi +mouse_netterm +syntax

To use brew-built version of vim you might like to alias it with alias vim='/usr/local/bin/vim', or try any of other options.

  • which vim returns "/usr/local/bin/vim". This is the vim installed by brew not the vim installed by OS X. However still when I execute "vim --version" I get -farsi. It seems like "brew install" does not listen to the edit file and does not compile it with huge option. Any idea how I can debug this? – bman Jan 5 '14 at 22:31
  • @Dane Does /usr/local/bin/vim --version also show -farsi? – Mr. Tao Jan 6 '14 at 11:50
1

You can edit the brew's formula for vim which is probably at /usr/local/Library/Formula and in file named vim.rb. You can edit this file and add your needed options in the lines where it execute the compilation process such as system "make" or

system "./configure", "--prefix=#{HOMEBREW_PREFIX}",
                      "--mandir=#{man}",
                      "--enable-multibyte",
                      "--with-tlib=ncurses",
                      "--enable-cscope",
                      "--with-features=huge",
                      "--with-compiledby=Homebrew",
                      *opts

I don't think that it just implement some of the options, brew dynamically creates the compile options according to the application's compilation process and makefiles.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .