How do I reference the local ruby in a hash-bang executable?

末鹿安然 提交于 2019-12-10 15:30:49

问题


I have a Ruby executable (it's a bundler binstub) which starts with

#!/usr/bin/env ruby

On my server I have Ruby 193 installed via RVM.

$ which ruby
-> /home/dtuite/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

On my local machine, I also have Ruby installed via RVM, but in a different location (obviously!)

$ which ruby
-> /Users/davidtuite/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

When I try to run this executable on the server I get an error

/usr/bin/env: ruby: No such file or directory

Is there a way I can reference the locally available ruby in the hash-bang so that the same script will execute on both the server and the local machine?


回答1:


Try rvm-auto-ruby - it is explained in a somewhat different context in RVM's Textmate documentation.



来源:https://stackoverflow.com/questions/8819096/how-do-i-reference-the-local-ruby-in-a-hash-bang-executable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!