Getting funnel.pl to work in OS X

Thu 05 January 2012

There are several plugins for Vim and MacVim that require a connection to an external program such as R, Lisp or Octave. Some of them rely on a Perl-script written by Larry Clapp called funnel.pl to communicate with the external program. Unfortunately, this script can be difficult to get to work in OS X as it depends on the GNU Readline library.

Before you use this guide you should follow the instructions for the plugin you want to configure (e.g. for R, Lisp or Octave). At some point the instructions will tell you to start funnel.pl and it will fail with an error message like

Next, we need to install GNU Readline. If you use Homebrew it can be installed with

brewinstallreadline

Homebrew does not install the library system wide, as that would be in potential conflict with libedit, the library normally used in OS X. Instead, it places it in a subdirectory in your Homebrew directory structure. On my machine, this was /usr/local/homebrew/Cellar/readline/6.2.2. If you are unsure you can use the command

brewinforeadline

to see where it was installed.

Finally, we need to install Term::ReadLine::Gnu and link it to the GNU Readline library. You should be able to find the latest version here. I used version 1.20.