# Predefined variable to represent the ruby installation path?

**URL:** <https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136>\
**Category:** Ruby\
**Created:** [December 12, 2006, 2:31pm UTC](https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136 "2006-12-12T14:31:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliviabean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@oliviabean](https://www.ruby-forum.com/u/oliviabean)\
**Post date:** [December 12, 2006, 2:31pm UTC](https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136/1 "2006-12-12T14:31:27Z")

</div>

Is there a Predefined variable that represent the ruby installation  
path(on which directory ruby is installed)?

---

<div class="post-metadata">

**Author:** ![oliviabean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@oliviabean](https://www.ruby-forum.com/u/oliviabean)\
**Post date:** [December 12, 2006, 3:12pm UTC](https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136/2 "2006-12-12T15:12:09Z")

</div>

Olivia D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Is there a Predefined variable that represent the ruby installation  
> path(on which directory ruby is installed)?

on \*nix systems you can issue the command

$ which ruby  
/usr/bin/ruby

---

<div class="post-metadata">

**Author:** ![oliviabean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@oliviabean](https://www.ruby-forum.com/u/oliviabean)\
**Post date:** [December 12, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136/3 "2006-12-12T17:28:45Z")

</div>

Olivia D. wrote:

> Is there a Predefined variable that represent the ruby installation  
> path(on which directory ruby is installed)?
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

check out rbconfig.rb, eg:

require ‘yaml’  
require ‘rbconfig’

y Config::CONFIG

t.

---

<div class="post-metadata">

**Author:** ![oliviabean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@oliviabean](https://www.ruby-forum.com/u/oliviabean)\
**Post date:** [December 12, 2006, 7:21pm UTC](https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136/4 "2006-12-12T19:21:16Z")

</div>

It would seem that Config::CONFIG[‘bindir’] gives the directory from  
which  
the ruby executable is run. A lot of the other keys seem to hold  
promise,  
but are zero lengths strings ("") on my system (SunOS 5.8).

---

<div class="post-metadata">

**Author:** ![oliviabean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@oliviabean](https://www.ruby-forum.com/u/oliviabean)\
**Post date:** [December 13, 2006, 2:20pm UTC](https://www.ruby-forum.com/t/predefined-variable-to-represent-the-ruby-installation-path/79136/5 "2006-12-13T14:20:21Z")

</div>

Garry Offord wrote:

> It would seem that Config::CONFIG[‘bindir’] gives the directory from which  
> the ruby executable is run. A lot of the other keys seem to hold promise,  
> but are zero lengths strings ("") on my system (SunOS 5.8).

hmm. sounds like the installation of ruby itself needs someof  
improvement for SunOS.

t.
