Vim command-t plugin, Mac OS Sierra 10.12.6: could not load C extension - ruby

I just updated my OS X to Sierra 10.12.6. When I open vim and try to use command-t I am getting the following error:
command-t.vim could not load the C extension.
Please see INSTALLATION and TROUBLE-SHOOTING in the help.
Vim Ruby version: 2.5.0-p0
Expected version: 2.4.1-p111
For more information type: :help command-t
My current state of the world happened after the following:
1. brew uninstall ruby vim => brew install ruby vim
I've tried implementing advice from the following stackoverflow + github issues:
Vim Command-T plugin error: could not load the C extension
https://github.com/wincent/command-t/issues/214
https://github.com/wincent/command-t/issues/196
https://github.com/wincent/command-t/issues/275
https://github.com/wincent/command-t/issues/119
https://github.com/wincent/command-t/issues/271
https://github.com/wincent/command-t/issues/242
https://askubuntu.com/questions/49469/command-t-vim-could-not-load-c-extension
https://wincent.com/forums/command-t/topics/427
And of course, the command-t documentation: (https://github.com/wincent/command-t/blob/master/doc/command-t.txt). Unfortunately, most of these examples are old and not relevant to the most recent MacOS, Ruby, or Vim versions. The path to my ruby extconf.rb is also slightly different than the examples...
Path to where extconf.rb lives in the examples:
cd ~/.vim/bundle/command-t/ruby/command-t
Path on my computer:
cd ~/.vim/bundle/command-t/ruby/command-t/ext/command-t
Any advice is greatly appreciated.

Have you build the C-extension? If not, run
ruby extconf.rb && make
in the directory
~/.vim/bundle/command-t/ruby/command-t/ext/command-t
Afterwards, command-t should work. If not, you could post the output of make here.

Related

El Capitan + Ruby/Brew/major issues

I've read a ton about how El Capitan's SIP messes up brew, ruby, and it's gems. The most recent thing I read is that brew was updated to better support El Capitan, so I followed a number of commands from an article online and apparently cleaned my whole system up and reinstalled all gems. Now, from terminal, everything works great. I don't have to write anything special to install gems... just gem install <name>.
However, SublimeText seems to be using a different Ruby. If I type which ruby, it shows as /usr/local/bin/ruby. But in SublimeText, it's showing this error about not finding the right gem (mechanize in this case): /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire': cannot load such file -- mechanize (LoadError)`
I tried creating a different build system file for Ruby, which points to ruby at /usr/local/bin/ruby, but it still shows this error (but below, it shows [cmd: ['/usr/local/bin/ruby']...
This has also caused me major issues trying to get the shoes gem to install.
Long question shortened: is there a definitive way to clear my system of all past brew, ruby, gems, etc etc, and redo it in a proper way that actually works for El Capitan?
Checkout #paskal answer here: Ruby 'require' error: cannot load such file
Try changing require <file name> with require "./<File name>".

Vim doesn't work after rvm ruby update

I'm using rvm on ubunut 13.04. Today I updated ruby with latest 1.9.3 version.
Now, when I try to start vim I get:
vim: error while loading shared libraries: libruby.so.1.9: cannot open shared object file: No such file or directory.
ldd $(which vim) | grep ruby gives libruby.so.1.9 => not found
Any idea how to fix it?
The Vim binaries are compiled against a particular Ruby (, Python, Perl, etc.) version. If that version vanishes, the integration is broken.
You can try to put back the required library with a link (something like libruby.so.1.9 -> libruby.so.1.9.3). If that fails, you have to find a corresponding Vim version or compile Vim yourself.

How do I get rbenv to keep debugging symbols?

I installed the development version of Ruby 2 via rbenv on Mac OS X v10.8.3, and am using it to compile a gem I'm working on. I have a memory problem I want to debug. Unfortunately, whenever I run valgrind, gdb, or cgdb in the context of a rake spec, I get a whole bunch of errors like this one:
warning: Could not find object file "/private/var/folders/5f/h1s00nhn0rv4ckkpg4k_bwhr0000gn/T/ruby-build.20130331232604.54521/ruby-2.0.0-dev/main.o" - no debug information available for "main.c".
Obviously, that ruby-build directory no longer exists.
I get a series of likely-related errors from valgrind. Here are examples:
--2564-- /Users/jwoods/.rbenv/versions/2.0.0-dev/lib/libyaml-0.2.dylib:
--2564-- dSYM directory is missing; consider using --dsymutil=yes
If I try to use that --dsymutil=yes option, I get errors which are basically the same as those from gdb:
warning: (x86_64) /private/var/folders/5f/h1s00nhn0rv4ckkpg4k_bwhr0000gn/T/ruby-build.20130331232604.54521/ruby-2.0.0-dev/ext/openssl/ossl_bn.o unable to open object file
Per an answer to another question, I tried running info target inside gdb. Here is the output.
Is there some way I can instruct rbenv to put the debugging symbols somewhere that they won't get cleaned up?
I'm using GCC 4.7.1, which I installed via homebrew. My exact Ruby version string is ruby 2.1.0dev (2013-04-01 trunk 40029) [x86_64-darwin12.3.0], and my rbenv version is 0.4.0.
According to the documentation for ruby-build:
Both ruby-build and rbenv install accept the -k or --keep flag, which tells ruby-build to keep the downloaded source after installation. This can be useful if you need to use gdb and memprof with Ruby.
So try ruby-build install X -k, where X is the version number.

How to tell Terminal which version of Ruby to use?

I have two related questions that I was hoping someone could help out with.
I recently installed Ruby 1.9.2 on my Mac (running Snow Leopard 10.6.4) and I haven’t been able to figure out how to get Terminal to use the new Ruby as a default, rather than the factory-installed Ruby 1.8.7. The old Ruby 1.8.7 is located in my ~/usr/bin/ruby directory while the new Ruby 1.9.2 is in ~/usr/local/bin/ruby. Someone said that I need to put the new version of Ruby's directory in the PATH prior to the old version's directory so that the system looks there first - is this correct? If so, can anyone provide step by step instructions on how to do this?
I’ve created a new directory but can’t seem to figure out the correct way to add that directory to my PATH using the Terminal bash shell. I tried using the instructions that I found here (http://www.macgasm.net/2008/04/10/ad...thin-terminal/) twice but they didn't work for me. The directory containing my program ("Ruby_Programs") shows up in the PATH but when I try to run "ruby newprogram.rb" from the command line it results in ":ruby: No such file or directory -- newprogram.rb (LoadError)". The file definitely exists and is a functional Ruby program. I did change the name of the directory to "Ruby Programs" and then back to "Ruby_Programs" - could that have somehow caused this problem?
Any help would be greatly appreciated. Here is my current PATH:
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/sbrriffe/src:/usr/X11/bin:/Users/sbriffe/Ruby_Programs/:
You might want to check out rvm. You can install multiple versions of ruby side by side and easily switch between them. If you follow the rvm installation notes you won't have any more path problems.
Your Ruby Programs directory shouldn't be in your path: the location of your ruby interpreter should be. Then, you cd to the location of your ruby program, and run it from there: ruby program.rb.
Since you are on a Mac, check out homebrew for something that will make installing software easier. I have my homebrew set up in /usr/local, and it works great.
Once you have installed stuff where you need it, then you'll want to adjust your $PATH. The items in $PATH are searched in the order they appear, so in your ~/.bashrc, you'll want to add:
export PATH=/usr/local/bin:$PATH
To make sure /usr/local/bin gets searched before /usr/bin.
I would use RVM to get everything installed, and then once you have RVM installed it is easy to set your default Ruby version.
Check out https://rvm.io/ -- once you have that installed you can change your default by using : $ rvm use 1.9.2 --default
hope that helps- you can do this with any version, not only 1.9.2

Getting Textmate to recognize Ruby version upgrade

I used the instructions at http://bparanj.blogspot.com/2010/06/installing-ruby-191-on-snow-leopard.html to install Ruby version 1.92 on my Mac running Snow Leopard. The only deviation is in step 3, which calls for .bash_profile to be updated. I have .profile, but not .bash_profile, in my home directory, so I added the export command to the last line of .profile. The installation completed successfully (with the same two warning messages as mentioned, which I too disregarded), as Ruby -v in a terminal prints
ruby 1.9.2dev (2010-07-02 revision 28524) [x86_64-darwin10.4.0].
When I run Textmate, however, cntrl-R invokes Ruby version 1.8.7, as it did before the 1.9.2 installation. In Textmate's Preferences-Advanced-Shell Variables, TM_RUBY is set to /usr/bin/ruby. The (binary alias) file 'ruby' has not been updated. What is the easiest way for me to instruct Textmate to use the newer version of Ruby? Please note my understanding of OS X is relatively limited.
What is the easiest way for me to
instruct Ruby to use the newer version
of Ruby?
I believe you mean "What is the easiest way for me to instruct Textmate to use the newer version of Ruby?"
Assuming that is the case, have you tried to edit the TM_RUBY shell variable to point to your newly installed version? According to the docs you referenced, it should be somewhere under /usr/local (most likely /usr/local/bin/ruby).
You can find out the location of your ruby installation by typing the following in your terminal window:
$ which ruby
/usr/local/bin/ruby
then perform the following to verify the version
$ ruby -v
Once you have the proper ruby path, in Textmate, double-click the 'value' of the TM_RUBY shell variable & type in the path to your 1.9.2 install.
Why not just create a .bash_profile file in your home directory?

Resources