I recently moved to a new iMac and did a clean install. Consequently not everything works like it did on my MBP. I made several changes suggested by @awsmsce and have incorporated that into the following. Still have the problem.
A ruby script that uses the gem mini_exiftool throws an error when run from TextMate (same error when run from command line). Here's the beginning of the script.
#!/usr/bin/env ruby
require 'rubygems'
require 'fileutils'
include FileUtils
require 'find'
require 'yaml'
require "time"
require 'shellwords'
require 'mini_exiftool'
TextMate reports LoadError: cannot load such file — mini_exiftool
and
method require in kernel_require.rb at line 55
Path to kernel_require.rb
is /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb
which possibly shows a problem. Not running the same ruby as where the gems are. But with changes recommended by @awsmsce now in /Users/gscar/.rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb
so that's not the issue
Terminal chruby
>> * ruby-2.5.1
ruby -v
>> ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
gem list
>> mini_exiftool (2.9.0)
exiftool -ver
>> 11.17
TextMate PATH
variable is $PATH:$HOME/.rubies/ruby-2.5.1/bin:$HOME/.rubies/ruby-2.5.1/shims:/usr/local/bin:/usr/texbin:/opt/local/bin
system('gem env')
:
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.2.3
- RUBY VERSION: 2.3.7 (2018-03-28 patchlevel 456) [universal.x86_64-darwin17]
- INSTALLATION DIRECTORY: /Users/gscar/.gem/ruby/2.5.1/gems
- USER INSTALLATION DIRECTORY: /Users/gscar/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
- EXECUTABLE DIRECTORY: /Users/gscar/.gem/ruby/2.5.1/gems/bin
- SPEC CACHE DIRECTORY: /Users/gscar/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-17
- GEM PATHS:
- /Users/gscar/.gem/ruby/2.5.1/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/gscar/Library/Application Support/TextMate/Managed/Bundles/Bundle Support.tmbundle/Support/shared/bin
- /Users/gscar/.rubies/ruby-2.5.1/bin
- /Users/gscar/.rubies/ruby-2.5.1/shims
- /usr/local/bin
- /usr/texbin
- /opt/local/bin
Gem.path: ["/Users/gscar/.gem/ruby/2.5.1/gems"]
I'm updating this after having been on a trip for a month and still need this script. I changed the order of the gems, shows that some download but not others. gem list
shows mini_exiftool (2.9.0)
among others. If I hard code to require '/Users/gscar/.gem/ruby/2.5.1/gems/mini_exiftool-2.9.0/lib/mini_exiftool.rb'
then the script fails similarly on another gem.
Okay, I think I have it now. Gonna take a swing:
set your PATH to the following:
export PATH=$PATH:$HOME/.rubies/ruby-2.5.1/bin:$HOME/.rubies/ruby-2.5.1/shims:/usr/local/bin:/usr/texbin:/opt/local/bin
set your TM_RUBY variable to:
$HOME/.rubies/ruby-2.5.1/bin/ruby
I think you currently have ruby added to the path, but not the binaries or shims.
If this isn't working, try
puts Gem.path
, and make sure it points to the right location.Make sure the gem you are trying to call is where you expect it
gem which mini_exiftool
If they are wrong, you might need to set these
export GEM_HOME=[WHATEVER YOUR GEM DIR IS] export GEM_PATH=[WHATEVER YOUR GEM DIR IS]