Reputation: 6053
which ruby
- /usr/local/bin/ruby
.bash_profile
has the above path
I have not left any trailing spaces before #!/usr/bin/env ruby
in the ruby script
When I try to run sh ruby_script
, it gives require: command not found
. It is not able to recognize any of the ruby commands.
I checked all the other posts getting the same error, and fixed everything accordingly. What else could I be missing?
Upvotes: 4
Views: 19542
Reputation: 75588
Running sh ruby_script
is wrong. You must run ruby ruby_script
instead. If the file is executable run ./ruby_script
.
Upvotes: 23
Reputation: 24083
sh ruby_script
is invoking the shell. Try either
/path/to/ruby_script
or
ruby /path/to/ruby_script
Upvotes: 1