我最近搬到了新的 iMac 并进行了全新安装。因此,并非一切都像在我的 MBP 上那样工作。我进行了@awsmsce 建议的几处更改,并将其合并到以下内容中。还是有问题。
使用 gem mini_exiftool 的 ruby 脚本在从 TextMate 运行时会引发错误(从命令行运行时会出现同样的错误)。这是脚本的开头。
#!/usr/bin/env ruby
require 'rubygems'
require 'fileutils'
include FileUtils
require 'find'
require 'yaml'
require "time"
require 'shellwords'
require 'mini_exiftool'
TextMate 报告LoadError: cannot load such file — mini_exiftool
和
method require in kernel_require.rb at line 55
路径可能表明存在问题kernel_require.rb
。/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb
运行的红宝石与宝石所在的地方不同。但是现在有了@awsmsce 推荐的更改,/Users/gscar/.rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb
所以这不是问题
终端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
TextMatePATH
变量是$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"]
我在旅行一个月后更新了这个,仍然需要这个脚本。我更改了 gems 的顺序,显示一些下载但没有其他的。gem list
节目mini_exiftool (2.9.0)
等。如果我硬编码,require '/Users/gscar/.gem/ruby/2.5.1/gems/mini_exiftool-2.9.0/lib/mini_exiftool.rb'
那么脚本在另一个 gem 上同样失败。