running gem

P

Paul Vudmaska

I'm testing a new host. All is not so great. It is bsd. I'm kind of new
to unix.

* [Download]
<http://rubyforge.org/project/showfiles.php?group_id=126> RubyGems
* check
* Unpack the distribution (zip or tar.gz)
* check
* cd rubygems-version.number
* yep
* /made myself super use/r
* ruby install.rb (NOTE: You'll need to have write access to your
Ruby site_library directory).


The install of gems seemed to go ok.(i dont remember the message
exactly but it was positive)

But when running
#>gem -Rl

#>env: ruby: No such file or directory

I've restarted my terminal in case there was a path problem.

I've got these aliases in .cshrc

alias ruby /usr/local/bin/ruby18
alias irb /usr/local/bin/irb18

If that makes a difference.

Anyway, thanks.
 
C

Chad Fowler

I'm testing a new host. All is not so great. It is bsd. I'm kind of new
to unix.

* [Download]
<http://rubyforge.org/project/showfiles.php?group_id=126> RubyGems
* check
* Unpack the distribution (zip or tar.gz)
* check
* cd rubygems-version.number
* yep
* /made myself super use/r
* ruby install.rb (NOTE: You'll need to have write access to your
Ruby site_library directory).

The install of gems seemed to go ok.(i dont remember the message
exactly but it was positive)

But when running
#>gem -Rl

#>env: ruby: No such file or directory

Hi Paul. We us a program called "env" with the argument "ruby" to
find ruby in the path and run the script with whatever ruby was found
in the path. By the look of the error message, the env program can't
find ruby on your system for some reason. I ran it on my Mac with a
bogus program name and you can see that the output is similar:

tashi-delek:~ chadfowler$ /usr/bin/env hello_paul
env: hello_paul: No such file or directory

Now if I run env manually with "ruby" as the parameter, I see:

tashi-delek:~ chadfowler$ env ruby -e 'puts "hello"'
hello

It appears that the "env" program doesn't deal with shell aliases (not
surprising):

tashi-delek:~ chadfowler$ alias myruby=/usr/local/bin/ruby
tashi-delek:~ chadfowler$ myruby -v
ruby 1.9.0 (2004-04-30) [powerpc-darwin]
tashi-delek:~ chadfowler$ /usr/bin/env myruby
env: myruby: No such file or directory

Can you try changing the first line of your "gem" script to look like:
#!/usr/local/bin/ruby18

Alternatively, you could create a symbolic link to your ruby
interpreter and call it "ruby" instead of using the aliases:
ln -s /usr/local/bin/ruby18 /usr/local/bin/ruby

Chad
 
W

why the lucky stiff

Chad said:
We us a program called "env" with the argument "ruby" to
find ruby in the path and run the script with whatever ruby was found
in the path.

In the classic install.rb, the path to ruby is used rather than 'env'.
This is great for situations where ruby isn't anywhere that can be found
by 'whereis' or 'env'. The path is built like so:

require 'rbconfig'
c = ::Config::CONFIG
rubypath = c['bindir'] + '/' + c['ruby_install_name']

I like this approach a lot. This way, if I want to install RubyGems for
my Ruby 1.6 installation, then `ruby16 install.rb' will do the trick fine.

_why
 
C

Chad Fowler

Chad said:
We us a program called "env" with the argument "ruby" to
find ruby in the path and run the script with whatever ruby was found
in the path.

In the classic install.rb, the path to ruby is used rather than 'env'.
This is great for situations where ruby isn't anywhere that can be found
by 'whereis' or 'env'. The path is built like so:

require 'rbconfig'
c = ::Config::CONFIG
rubypath = c['bindir'] + '/' + c['ruby_install_name']

I like this approach a lot. This way, if I want to install RubyGems for
my Ruby 1.6 installation, then `ruby16 install.rb' will do the trick fine.

That's a good reason. I'll add that to the TODO list.

Chad
 
J

Jim Menard

Chad said:
We us a program called "env" with the argument "ruby" to
find ruby in the path and run the script with whatever ruby was found
in the path.

In the classic install.rb, the path to ruby is used rather than 'env'.
This is great for situations where ruby isn't anywhere that can be
found by 'whereis' or 'env'. The path is built like so:

require 'rbconfig'
c = ::Config::CONFIG
rubypath = c['bindir'] + '/' + c['ruby_install_name']

Shouldn't that be

rubypath = File.join(c['bindir'], c['ruby_install_name'])

so it works on some future OS that does not use '/' as its path
separator and has a shebang line in scripts and is not Windows?
I like this approach a lot. This way, if I want to install RubyGems
for my Ruby 1.6 installation, then `ruby16 install.rb' will do the
trick fine.

_why

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,371
Latest member
Brkaa

Latest Threads

Top