How do I change or edit Vim Homebrew recipe?

7,682

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:
7,682

Related videos on Youtube

ricardo
Author by

ricardo

I enjoy programming for work and as a pass-time; I mostly use R and Cpp (via Rcpp).

Updated on September 18, 2022

Comments

  • ricardo
    ricardo over 1 year

    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).

    • ricardo
      ricardo over 11 years
      @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
      ricardo over 11 years
      +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?
    • romainl
      romainl over 11 years
      I'm not in front of my mac so I can't help further.
    • Jason
      Jason over 11 years
      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.
  • echristopherson
    echristopherson over 11 years
    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.
  • slhck
    slhck over 11 years
    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.