Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use a Vim plugin that requires +clientserver, and the default brew Vim recipe does not include the appropriate flags, so I'm trying to add it to the ./configure step.

I tried building Vim from source, but without success. I would like to try either using an alternate recipe -- there's one with the flags set that I require here -- or perhaps editing the Homebrew recipe itself ... however I am unsure how to proceed.

Can someone please give me some pointers to help me get started using either the alternate recipe, or with editing the Homebrew recipe itself?

Ultimately, I would like to learn how to do both things.


to compile terminal vim with the clientserver features, i did the following:

brew edit vim

and edited the ./configure options as follows (removed --enable-gui=no, and --without-x, and added --enable-gui=gtk2):

system "./configure", "--prefix=#{HOMEBREW_PREFIX}",
                      "--mandir=#{man}",
                      "--disable-nls",
                      "--enable-multibyte",
                      "--with-tlib=ncurses",
                      "--enable-cscope",
                      "--enable-rubyinterp",                            
                      "--enable-pythoninterp",
                      "--enable-gui=gtk2",
                      "--with-features=huge",
                       *language_opts

Then rvm use system (a ruby bug workaround that's always required for brewing vim); then brew install vim; and finally brew unlink vim && brew link vim.

To install from the target URL:

brew install https://gist.github.com/2004942/vim.rb

(though in this case, it is not what i did).

share|improve this question
    
@romainl not an option for me, unfortunately. I had been using mvim, but am trying a tmux solution and that's what is pushing me into terminal vim. –  ricardo Dec 29 '12 at 20:34
1  
So what? mvim -v runs MacVim's CLI vim executable in your terminal. Building Vim on Mac OS X is an almost completely pointless exercise. –  romainl Dec 29 '12 at 21:00
    
+1 i was totally unaware. i guess the point is that i've now learned something new about homebrew. starting mvim -v --servername foo just failed to attach a server name -- what am i missing? –  ricardo Dec 29 '12 at 21:32
    
I'm not in front of my mac so I can't help further. –  romainl Dec 29 '12 at 21:52
    
You can install MacVim to replace your system vim so you don't have to run mvim. brew install macvim --override-system-vim. Also if you are using tmux you might also want the pasteboard support. I think it is brew install reattach-to-namespace. Don't have my notes with me now. –  Jason Dec 30 '12 at 1:43

1 Answer 1

up vote 4 down vote accepted

Here's how to edit a Homebrew formula:

brew edit formula

So, in your case that'd be brew edit vim. Save, and reinstall. The edited formula is cached locally until you update Homebrew—if I recall correctly, you'll be asked what to do with your changed formula once you update Brew.

You could even go as far as creating your own formula though, which is explained in the Formula Cookbook. The basic steps are:

  • Create a tarball for your software and call brew create for that URL e.g. brew create http://example.com/foo-0.1.tar.gz
  • Build it with brew install -vd foo, where debugging and verbose mode is on
share|improve this answer
1  
And if you know Git at all, you'll probably want to make your custom edit in its own branch. The formulas are all in /usr/local/Library/Formula, which is in a Git repository rooted at /usr/local. Unfortunately Homebrew doesn't look at different branches when installing formulas, so in order to install your custom formula in this case you need to go to the repo, change to your branch, run git install vim (or whatever formula), and then change back to master. That's what was recommended to me, anyway. –  echristopherson Dec 29 '12 at 7:49
    
True, that does make sense but requires a little Git knowledge. If it's just one formula, I personally would probably just edit it in the Master and forget about it. –  slhck Dec 29 '12 at 7:50
    
+1 thanks, that is helpful. –  ricardo Dec 29 '12 at 20:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.