Vim Command-T plugin error: could not load the C extension

I'm trying to install the Command-T plugin.

I compiled vim following the instructions in this comment: Installing vim with ruby support (+ruby)

So now there's the +ruby flag, but still when I try to use the plugin I get this error:

command-t.vim could not load the C extension
Please see INSTALLATION and TROUBLE-SHOOTING in the help              
For more information type:    :help command-t

I have ruby on my system:

> ruby -v
> ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

suggestions?


Solution 1:

Go to plugin dir and run the following command:

rake make

It compiles the plugin extension you need.

Solution 2:

I ran into the same error but after reading the manual a bit more thorough I found the following helpful.

Tagged from the INSTALLATION section in https://github.com/wincent/Command-T

The C extension must then be built, which can be done from the shell. If you use a typical |'runtimepath'| then the files were installed inside ~/.vim and you can build the extension with:

cd ~/.vim/ruby/command-t/ext/command-t
ruby extconf.rb
make

Solution 3:

You must perform the build using the same version of Ruby that Vim itself is linked against.

Are you using RVM or rbenv? Personally, I was using rbenv and MacVim. I had this error because I was trying use ruby 1.8.7 patch 352. I switched back to 1.8.7 patch 249 using rbenv shell system before running ruby extconf.rb and make, then everything worked fine.

Afterwards, you can revert your shell back using rbenv shell --unset.

Solution 4:

On debian squeeze I also had to install the json library for ruby with apt-get install libjson-ruby1.8

Solution 5:

Command-T requires a compiled component. The error message suggests you haven't followed the installation instructions for the plugin completely.