Reputation: 1649
I am very new to ruby and I'm trying to spawn a process using the spawn command
but I encounter
undefined method `spawn' for main:Object (NoMethodError)
when I attempt to call spawn with a single argument. I tried
sudo gem install spawn
which installed something but it returns the same error.
I'm using ruby version 1.8.7 on Ubuntu 12.04 which is what I got when I ran
sudo apt-get install ruby
Can someone ofer some guidance?
Upvotes: 0
Views: 165
Reputation: 611
You currently running Ruby version 1.8.7, Which was added in from 1.9.1.
The easiest way to managed your ruby version is via the tool called RVM
Downloading RVM (Do not sudo this command)
\curl -sSL https://get.rvm.io | bash -s stable
Then you'll need to add the location to sources(You'll probably need to reload your bash for rvm to work)
source ~/.rvm/scripts/rvm
You can install your desired version like so(replace ruby_version with one you would like to install, eg 2.1.4)
rvm install ruby_version
To list the available version on your machine
rvm list
To use a version of ruby run
rvm use ruby_version
If you have any trouble refere to the RVM website
Upvotes: 0
Reputation: 37419
The spawn
API is available only on ruby version 1.9.1 and up...
Upvotes: 2