I recently put an SSD into my MacBook Pro, and now I cannot seem to install Gosu. It installs fine, and says there was 1 gem installed, but when I build and run any Gosu code, I get the following error message:
require': cannot load such file -- gosu (LoadError)require'
from /Users/Eamonn/Programming/Ruby/Tests/main.rb:10:in `<main>'
[Finished in 0.2s with exit code 1]
[shell_cmd: ruby "/Users/Eamonn/Programming/Ruby/Tests/main.rb"]
This is both in Sublime Text 3 and from the command line. It seems to me that it cannot find my Gosu installation. I have no idea where it installs to. I installed it using "sudo gem install gosu", because otherwise it just get's stuck hanging. I'm still pretty inexperienced with Gosu, but I have a better understanding of both game development and Ruby now, so I think I'll give it a go again!
I doubt this would be the issue, but when installing I get LOADS of errors from CPP files. I have Xcode Command Line Tools installed, and I had one hell of a time installing Ruby itself. It look me like 5 hours to install it because it kept just producing errors and not working, but after trying the same thing over and over again it worked. This isn't working with Gosu :(
Thanks! Any help is appreciated!
P.S. I'm using the example Gosu code, which is the following:
This very simple example demonstrates the Gosu::Window update/draw
loop by incrementing a counter on each update, and drawing the value
on each call to draw.
class GameWindow < Gosu::Window
self.caption = "Update/Draw Demo"
# we load the font once during initialize, much faster than
# loading the font before every draw
@font = Gosu::Font.new(self, Gosu::default_font_name, 20)
@counter = 0
@counter += 1
@font.draw(@counter, 0, 0, 1)
if id == Gosu::KbEscape
close # exit on press of escape key
window = GameWindow.new
Keep in mind that OS X 10.9 ships with two Ruby installations already, 2.0.0 and 1.8.7. Gosu works fine with both of these (I'm writing this from a 10.9 machine). My suggestion would be to skip
rvm and just install Gosu into the 2.0.0 Ruby using the Xcode command line tools.
rvm has a habit of picking bizarre compilers from homebrew to compile stuff.
To try this, use
rvm use system, verify that it is indeed Ruby 2.0.0 and then try
sudo gem install gosu.
If you are trying to avoid installing gems into the system, then please post the CPP errors you've received and maybe I have an idea about those.
Ok well I will post the CPP errors.
I didn't get Ruby pre installed on my Mavericks, I had to download Ruby myself. I installed V2.1.0. I am using an official Mavericks installation, not a Hackintosh.
I decided to install JewelaryBox and use Ruby 1.9.3-p484, just in case Gosu didn't work with Ruby 2.1.0.
I cannot find a way to download Ruby 2.0.0, just Ruby 2.1.0.
Anyway, after switching to Ruby 2.1.0 using JewelaryBox, and using the RVM command, Gosu now works! :D Thanks!
?!? I am pretty sure that OS X ships with Ruby. Try "/usr/bin/ruby -v" on the Terminal - it should print "ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]".
Anyway, if 2.1.0 works, then all the better, I guess! :)
I'd like to chime in to add that, if you absolutely must manage multiple ruby versions on your system, use rbenv
instead of rvm. It's missing some of the more advanced features of rvm, but you probably don't use them.
rbenv doesn't handle installing Ruby versions on its own, but there is a plugin, ruby-build
, that will do that for you.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill