我试图在mac automator中运行ruby脚本。首先,我选择了#34;运行Shell脚本"并且在下拉中我选择/ bin / zsh而不是/ usr / bin / ruby,因为我想运行ruby 2.3.0而不是/ usr / bin / ruby中的任何版本。
/Users/me/.rvm/rubies/ruby-2.3.0/bin/ruby /Users/me/Projects/Private/SubSeeker/main.rb $1
这就是自动机脚本的样子,它运行良好,直到我需要一些东西。例如,当我需要rest-client时,我会这样做:require 'rest-client'
但由于某种原因,它不起作用。我收到这个错误:
/Users/me/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rest-client (LoadError)
from /Users/me/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/me/Projects/Private/SubSeeker/scraper.rb:1:in `<top (required)>'
from /Users/me/Projects/Private/SubSeeker/main.rb:4:in `require_relative'
from /Users/me/Projects/Private/SubSeeker/main.rb:4:in `<main>'
已安装gem,我可以在不通过automator运行时使用该脚本。
知道我在这里做错了吗?