Forum: Ruby Checking the name of the host Operating System

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sonny C. (Guest)
on 2007-02-13 22:07
Hey Guys,

Anyone know how I can determine the name of the host operating system
from within Ruby?

Sonny.
James G. (Guest)
on 2007-02-13 22:25
(Received via mailing list)
On Feb 13, 2007, at 2:07 PM, Sonny C. wrote:

> Hey Guys,
>
> Anyone know how I can determine the name of the host operating system
> from within Ruby?

Sure:

 >> RUBY_PLATFORM
=> "i686-darwin8.8.1"
 >> require "rbconfig"
=> false
 >> Config::CONFIG["target"]
=> "i686-apple-darwin8.8.1"
 >> Config::CONFIG["arch"]
=> "i686-darwin8.8.1"
 >> Config::CONFIG["target_os"]
=> "darwin8.8.1"

Hope that helps.

James Edward G. II
Sonny C. (Guest)
on 2007-02-13 22:29
Thanks James, that's exactly what I need.

Sonny.

James G. wrote:
> On Feb 13, 2007, at 2:07 PM, Sonny C. wrote:
>
>> Hey Guys,
>>
>> Anyone know how I can determine the name of the host operating system
>> from within Ruby?
>
> Sure:
>
>  >> RUBY_PLATFORM
> => "i686-darwin8.8.1"
>  >> require "rbconfig"
> => false
>  >> Config::CONFIG["target"]
> => "i686-apple-darwin8.8.1"
>  >> Config::CONFIG["arch"]
> => "i686-darwin8.8.1"
>  >> Config::CONFIG["target_os"]
> => "darwin8.8.1"
>
> Hope that helps.
>
> James Edward G. II
This topic is locked and can not be replied to.