Basic Gems are Missing?

Hi, I was wondering if someone could help me out. I'm still relatively
new to mac interface and have been trying to get back into ruby from a
windows perspective from a few years ago. I cannot seem to get my
computer to recognize simple gem commands such as 'require' within my
code. I use textwrangler and direct terminal lines but get results that
return things such as cannot find command 'require.rb'. I have also done
a search through all of my lists in my env's and it continues to change
with each version of ruby that I utilize. I am using the most recent
version of RVM and possibly have some other management software that may
be conflicting- I'm not sure. I think that I have honestly broken my
library but cannot figure out the exact problem- possibly could have
deleted my default ruby repository. Any help would be amazing as I am
about to scream at the top of my lungs after months of not being able to
test anything that I have re learned with the exception of reiterating
code back into an online interactive tutor. I would be so grateful.

···

--
Posted via http://www.ruby-forum.com/.

Hello,

Can you copy and paste the exact output of the following commands in your terminal?

$ uname -a

$ which ruby

$ which gem

$ rvm list

$ env|grep -i ruby

Also, show us a piece of code that doesn't work if possible. I want to make sure that there's not some error in your code that might have missed.

Best Regards,

···

On 4 Φεβ 2014, at 05:55 , Raf Ri <lists@ruby-forum.com> wrote:

Hi, I was wondering if someone could help me out. I'm still relatively
new to mac interface and have been trying to get back into ruby from a
windows perspective from a few years ago. I cannot seem to get my
computer to recognize simple gem commands such as 'require' within my
code. I use textwrangler and direct terminal lines but get results that
return things such as cannot find command 'require.rb'. I have also done
a search through all of my lists in my env's and it continues to change
with each version of ruby that I utilize. I am using the most recent
version of RVM and possibly have some other management software that may
be conflicting- I'm not sure. I think that I have honestly broken my
library but cannot figure out the exact problem- possibly could have
deleted my default ruby repository. Any help would be amazing as I am
about to scream at the top of my lungs after months of not being able to
test anything that I have re learned with the exception of reiterating
code back into an online interactive tutor. I would be so grateful.

--
Posted via http://www.ruby-forum.com/\.

Panagiotis (atmosx) Atmatzidis

email: atma@convalesco.org
URL: http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5
--
The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."

I cannot seem to get my computer to recognize simple
gem commands such as 'require' within my code.

Hi.

require() is not a gem command - it is a ruby method.

You should be able to have ruby code running and working.

Does irb work? If so print hello world, then store this in a .rb file
and try again.

···

--
Posted via http://www.ruby-forum.com/\.

You should also clean up your system and write down exactly what you are
and were doing. It is not a good idea to just install RVM in the hope
that everything magically works afterwards.

After you cleaned up and removed all old files, install ruby anew but
make sure you follow the steps PROPERLY.

···

--
Posted via http://www.ruby-forum.com/.

Do you mean that you wish for me to write : print 'Hello World'? or that
you want for me to run a program called hello world?

···

--
Posted via http://www.ruby-forum.com/.

localhost:~ user$ uname -a
Darwin localhost 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7
16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

which ruby
/Users/user/.rvm/rubies/ruby-2.1.0/bin/ruby

which gem
/Users/user/.rvm/rubies/ruby-2.1.0/bin/gem

rvm list

rvm rubies

   jruby-1.7.10 [ x86_64 ]
   ruby-1.9.2-p320 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
   ruby-2.0.0-p353 [ x86_64 ]
=* ruby-2.1.0 [ x86_64 ]

# => - current
# =* - current && default
# * - default

env>grep -i ruby
GEM_HOME=/Users/user/.rvm/gems/ruby-2.1.0
IRBRC=/Users/user/.rvm/rubies/ruby-2.1.0/.irbrc
MY_RUBY_HOME=/Users/user/.rvm/rubies/ruby-2.1.0
PATH=/Users/user/.rvm/gems/ruby-2.1.0/bin:/Users/user/.rvm/gems/ruby-2.1.0@global/bin:/Users/user/.rvm/rubies/ruby-2.1.0/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/X11/bin:/Users/user/.rvm/bin
GEM_PATH=/Users/user/.rvm/gems/ruby-2.1.0:/Users/user/.rvm/gems/ruby-2.1.0@global

···

--------------------------------------------------------------------------
As far as a line of code, I won't even use one of my own. I'll call a
gem that I've been trying to test on my machine to show you. It should
be attached as a .rb file.

My error return in Aptana for running from the interface is as follows:

/Users/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- rubygame (LoadError)
  from
/Users/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
  from /Users/user/Documents/Aptana Studio 3
Workspace/PacAttack/PacAttack
Ruby\/gameprog1/gameprog1/01_main_loop.rb:3:in `<main>'

I'm absolutely certain that whatever this issue is will end up being
user error on my behalf- I just hope that you could help me figure it
out. Thanks a ton man.

--
Posted via http://www.ruby-forum.com/.

Also @Panagiotis Atmatzidis, I cannot attach a .rb file to send so I'll
just copy and paste the test file.

#!/usr/bin/env ruby
require 'rubygems'
require 'rubygame'
include Rubygame

# The main loop method. This is called at the
# bottom of the file. This contains the infinite
# main loop, and is exited when a QuitEvent
# is received.
def main_loop
  # Set up the objects the main loop will
  # need.

  # The screen is the window displayed on the
  # screen.
  screen = Screen.new [640, 480]

  # The event queue handles events from the
  # operating system
  queue = EventQueue.new

  # The clock limits the framerate to 30fps
  clock = Clock.new
  clock.target_framerate = 30

  # This is the infinite main loop
  loop do
    # Pause the program for a short amount of
    # time so it doesn't exceed 30fps
    clock.tick

    # Process all events, return if the window
    # was closed
    queue.each do|e|
      return if e.is_a? QuitEvent
    end

    # Fill the screen with a grey color and
    # display it on the monitor
    screen.fill [200, 200, 200]
    screen.update
  end

ensure
  Rubygame.quit
end

# If this file was the one executed from the
# command line, run the main loop.
if $0 == __FILE__
  main_loop
end

···

--
Posted via http://www.ruby-forum.com/.

Just realized that was a terrible example code. I'll try to find a
better one promptly.

···

--
Posted via http://www.ruby-forum.com/.

Marc Heiler wrote in post #1135629:

You should also clean up your system and write down exactly what you are
and were doing. It is not a good idea to just install RVM in the hope
that everything magically works afterwards.

After you cleaned up and removed all old files, install ruby anew but
make sure you follow the steps PROPERLY.

How would you recommend that I "clean my system?"
Do you mean that I should run a standard OS clean up utility or
something more acute?

···

--
Posted via http://www.ruby-forum.com/\.

Dear Raf Ri,

The problem raises _only_ with rubygame?

If so, try to follow the rubygame install instructions once again.

Your error messages point that it can't find the rubygame gem.

If the problem occurs with other gems, make sure you have installed
them before "requiring" them.
Most simple gems installs with

$ gem install <gem_name>

Tell us if any progress.

Best regards,
Abinoam Jr.

···

On Thu, Feb 6, 2014 at 12:48 AM, Raf Ri <lists@ruby-forum.com> wrote:

localhost:~ user$ uname -a
Darwin localhost 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7
16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

which ruby
/Users/user/.rvm/rubies/ruby-2.1.0/bin/ruby

which gem
/Users/user/.rvm/rubies/ruby-2.1.0/bin/gem

rvm list

rvm rubies

   jruby-1.7.10 [ x86_64 ]
   ruby-1.9.2-p320 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
   ruby-2.0.0-p353 [ x86_64 ]
=* ruby-2.1.0 [ x86_64 ]

# => - current
# =* - current && default
# * - default

env>grep -i ruby
GEM_HOME=/Users/user/.rvm/gems/ruby-2.1.0
IRBRC=/Users/user/.rvm/rubies/ruby-2.1.0/.irbrc
MY_RUBY_HOME=/Users/user/.rvm/rubies/ruby-2.1.0
PATH=/Users/user/.rvm/gems/ruby-2.1.0/bin:/Users/user/.rvm/gems/ruby-2.1.0@global/bin:/Users/user/.rvm/rubies/ruby-2.1.0/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/X11/bin:/Users/user/.rvm/bin
GEM_PATH=/Users/user/.rvm/gems/ruby-2.1.0:/Users/user/.rvm/gems/ruby-2.1.0@global
--------------------------------------------------------------------------
As far as a line of code, I won't even use one of my own. I'll call a
gem that I've been trying to test on my machine to show you. It should
be attached as a .rb file.

My error return in Aptana for running from the interface is as follows:

/Users/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- rubygame (LoadError)
  from
/Users/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
  from /Users/user/Documents/Aptana Studio 3
Workspace/PacAttack/PacAttack
Ruby\/gameprog1/gameprog1/01_main_loop.rb:3:in `<main>'

I'm absolutely certain that whatever this issue is will end up being
user error on my behalf- I just hope that you could help me figure it
out. Thanks a ton man.

--
Posted via http://www.ruby-forum.com/\.

Dear Raf Ri,

One more thing, did you try to run the ruby code from terminal?

Please see if it finds the gem when running from terminal, so we could
isolate it as an aptana issue.

One more thing to do is to run this _inside_ a ruby script inside
Aptana. Just to see if Aptana is running the scripts in a different
enviroment than your terminal.

#!/usr/bin/env ruby

commands =
  [ "which ruby",
    "which gem",
    "rvm list",
    "gem list | grep rubygame",
    "env | grep -i ruby" ]

commands.each do |cmd|
  puts ">> Running: #{cmd}"
  puts `#{cmd}`
  puts
end

Best regards,
Abinoam Jr.

···

On Thu, Feb 6, 2014 at 6:03 AM, Abinoam Jr. <abinoam@gmail.com> wrote:

Dear Raf Ri,

The problem raises _only_ with rubygame?

If so, try to follow the rubygame install instructions once again.

Mac Install Guide · rubygame/rubygame Wiki · GitHub

Your error messages point that it can't find the rubygame gem.

If the problem occurs with other gems, make sure you have installed
them before "requiring" them.
Most simple gems installs with

$ gem install <gem_name>

Tell us if any progress.

Best regards,
Abinoam Jr.

On Thu, Feb 6, 2014 at 12:48 AM, Raf Ri <lists@ruby-forum.com> wrote:

localhost:~ user$ uname -a
Darwin localhost 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7
16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

which ruby
/Users/user/.rvm/rubies/ruby-2.1.0/bin/ruby

which gem
/Users/user/.rvm/rubies/ruby-2.1.0/bin/gem

rvm list

rvm rubies

   jruby-1.7.10 [ x86_64 ]
   ruby-1.9.2-p320 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
   ruby-2.0.0-p353 [ x86_64 ]
=* ruby-2.1.0 [ x86_64 ]

# => - current
# =* - current && default
# * - default

env>grep -i ruby
GEM_HOME=/Users/user/.rvm/gems/ruby-2.1.0
IRBRC=/Users/user/.rvm/rubies/ruby-2.1.0/.irbrc
MY_RUBY_HOME=/Users/user/.rvm/rubies/ruby-2.1.0
PATH=/Users/user/.rvm/gems/ruby-2.1.0/bin:/Users/user/.rvm/gems/ruby-2.1.0@global/bin:/Users/user/.rvm/rubies/ruby-2.1.0/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/X11/bin:/Users/user/.rvm/bin
GEM_PATH=/Users/user/.rvm/gems/ruby-2.1.0:/Users/user/.rvm/gems/ruby-2.1.0@global
--------------------------------------------------------------------------
As far as a line of code, I won't even use one of my own. I'll call a
gem that I've been trying to test on my machine to show you. It should
be attached as a .rb file.

My error return in Aptana for running from the interface is as follows:

/Users/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require': cannot load such file -- rubygame (LoadError)
  from
/Users/user/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
`require'
  from /Users/user/Documents/Aptana Studio 3
Workspace/PacAttack/PacAttack
Ruby\/gameprog1/gameprog1/01_main_loop.rb:3:in `<main>'

I'm absolutely certain that whatever this issue is will end up being
user error on my behalf- I just hope that you could help me figure it
out. Thanks a ton man.

--
Posted via http://www.ruby-forum.com/\.

One more thing to do is to run this _inside_ a ruby script inside
Aptana. Just to see if Aptana is running the scripts in a different
enviroment than your terminal.

Oh nice, very true. I figured that could be an issue but I didn't think
to check for it outside of the graphical interface. Thanks

···

--
Posted via http://www.ruby-forum.com/\.

Just curious about... was it an Aptana issue?

(I mean, Aptana running the code in a different enviromment.)

Abinoam Jr.

···

On Sun, Feb 9, 2014 at 4:10 PM, Raf Ri <lists@ruby-forum.com> wrote:

One more thing to do is to run this _inside_ a ruby script inside
Aptana. Just to see if Aptana is running the scripts in a different
enviroment than your terminal.

Oh nice, very true. I figured that could be an issue but I didn't think
to check for it outside of the graphical interface. Thanks

--
Posted via http://www.ruby-forum.com/\.