ruby - Error running script on Mac OS but runs ok after ssh -


i have .sh script on mac os machine generate ipa file using phonegap. if log in machine via ssh, , run script, runs successfully. if try execute remotely, doing ssh , calling script below:

~$ ssh -i ~/.ssh/mykey admin@ip_address 'cd /users/admin/scripts && ./build.sh' 

then error:

/system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- xcodeproj (loaderror)     /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'     generate_scheme.rb:2:in `<main>' 

i have on beginning of .sh file:

#!/bin/bash  path=$path:/bin:/usr/bin:users/admin/.rvm/gems/ruby-2.2.4/bin:/users/admin/.rvm/gems/ruby-2.2.4@global/bin:/users/admin/.rvm/rubies/ruby-2.2.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/users/admin/.rvm/bin:/users/admin/.rvm/rubies/ruby-2.2.4/bin/xcodeproj:/users/admin/.rvm/rubies/ruby-2.2.4/bin/ruby  export path 

and line failing:

ruby generate_scheme.rb 

any appreciated, thank you.

ssh default establishes non-login shell , therefore not pick whatever environment settings in place user. specifically, on system not pick settings xcodeproj.

use bash --login establish login shell:

ssh -i ~/.ssh/mykey admin@ip_address -t 'bash --login -c "cd /users/admin/scripts;./build.sh"' 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -