# Running gem

**URL:** <https://rubytalk.org/t/running-gem/11439>\
**Category:** ruby-talk\
**Created:** [9 May 2004 23:18 UTC](https://rubytalk.org/t/running-gem/11439 "2004-05-09T23:18:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Vudmaska](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@Paul\_Vudmaska](https://rubytalk.org/u/Paul_Vudmaska)\
**Post date:** [9 May 2004 23:18 UTC](https://rubytalk.org/t/running-gem/11439/1 "2004-05-09T23:18:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Chad\_Fowler4](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Chad\_Fowler4](https://rubytalk.org/u/Chad_Fowler4)\
**Post date:** [9 May 2004 23:34 UTC](https://rubytalk.org/t/running-gem/11439/2 "2004-05-09T23:34:50Z")

</div>

> 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

> **···**
>
> On Mon, 10 May 2004 08:18:53 +0900, Paul Vudmaska [paul@vudmaska.com](mailto:paul@vudmaska.com) wrote:
> 
> > 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.

---

<div class="post-metadata">

**Author:** ![why\_the\_lucky\_stiff1](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@why\_the\_lucky\_stiff1](https://rubytalk.org/u/why_the_lucky_stiff1)\
**Post date:** [10 May 2004 06:50 UTC](https://rubytalk.org/t/running-gem/11439/3 "2004-05-10T06:50:04Z")

</div>

Chad Fowler wrote:

> 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

---

<div class="post-metadata">

**Author:** ![Chad\_Fowler4](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Chad\_Fowler4](https://rubytalk.org/u/Chad_Fowler4)\
**Post date:** [10 May 2004 10:42 UTC](https://rubytalk.org/t/running-gem/11439/4 "2004-05-10T10:42:44Z")

</div>

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

Chad

> **···**
>
> On Mon, 10 May 2004 15:50:04 +0900, why the lucky stiff [ruby-talk@whytheluckystiff.net](mailto:ruby-talk@whytheluckystiff.net) wrote:
> 
> > Chad Fowler wrote:
> > 
> > > 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.

---

<div class="post-metadata">

**Author:** ![Jim\_Menard3](https://avatars.discourse-cdn.com/v4/letter/j/d6d6ee/32.png) [@Jim\_Menard3](https://rubytalk.org/u/Jim_Menard3)\
**Post date:** [10 May 2004 12:14 UTC](https://rubytalk.org/t/running-gem/11439/5 "2004-05-10T12:14:35Z")

</div>

> Chad Fowler wrote:
> 
> > 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

> **···**
>
> ## On May 10, 2004, at 2:50 AM, why the lucky stiff wrote:
> 
> Jim Menard, [jimm@io.com](mailto:jimm@io.com), [http://www.io.com/~jimm/](http://www.io.com/~jimm/)  
> “It’s overkill, of course. But you can never have too much overkill.”  
> – Anonymous Coward on [slashdot.org](http://slashdot.org)
