How do you install a local gem?

Hi,

I downloaded the file:

wxruby-1.9.4-universal-darwin.gem.tar

How do I install that? When I try to untar it with this command:

tar -xvf /Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem.tar

I get the error:

data.tar.gz
tar: Read 3501 bytes from
/Users/autie/Desktop/wxruby-1.9.4-universal-darwin.gem.tar
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

And even if I did untar it, I don’t know how to install it. I install a
remote gem like this:

$ gem install -r wxruby

If it is a local file, do I just cd to the directory the file is in and
type:

$ gem install wxruby

???

Alle Thursday 31 January 2008, 7stud – ha scritto:

I get the error:

$ gem install -r wxruby

If it is a local file, do I just cd to the directory the file is in and
type:

$ gem install wxruby

???

In linux, you simply do:

gem install gem_file.gem

What I find strange is the name of the file you downloaded, since the
extension should be .gem, not .gem.tar. Did you get it from rubyforge?
From
the rubyforge wxruby page, I could download a file called

wxruby-1.9.4-universal-darwin.gem

Of course, being on linux, I can’t try to install it.

I hope this helps

Stefano

Stefano C. wrote:

Alle Thursday 31 January 2008, 7stud – ha scritto:

I get the error:

$ gem install -r wxruby

If it is a local file, do I just cd to the directory the file is in and
type:

$ gem install wxruby

???

In linux, you simply do:

gem install gem_file.gem
/Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem.tar

What I find strange is the name of the file you downloaded, since the
extension should be .gem, not .gem.tar. Did you get it from rubyforge?
From
the rubyforge wxruby page, I could download a file called>
wxruby-1.9.4-universal-darwin.gem

Of course, being on linux, I can’t try to install it.

I hope this helps

Stefano

Thanks for the response. This is the file I downloaded:

http://rubyforge.org/frs/download.php/30865/wxruby-1.9.4.tar.gz

I think OS X automatically unzips a file after I download it producing:

/Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem.tar

Alle Thursday 31 January 2008, 7stud – ha scritto:

the rubyforge wxruby page, I could download a file called>
http://rubyforge.org/frs/download.php/30865/wxruby-1.9.4.tar.gz

I think OS X automatically unzips a file after I download it producing:

/Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem.tar

This seems even more strange. The file wxruby-1.9.4.tar.gz is not the
gem
version, so, even if the file was automatically unzipped, it should be
called
wxruby-1.9.4.tar

If you want to use rubygems, you should download this file:
http://rubyforge.org/frs/download.php/30889/wxruby-1.9.4-universal-darwin.gem

then use

gem install wxruby-1.9.4-universal-darwin.gem

Stefano

Stefano C. wrote:

This seems even more strange. The file wxruby-1.9.4.tar.gz is not the
gem
version, so, even if the file was automatically unzipped, it should be
called
wxruby-1.9.4.tar

If you want to use rubygems, you should download this file:
http://rubyforge.org/frs/download.php/30889/wxruby-1.9.4-universal-darwin.gem

then use

gem install wxruby-1.9.4-universal-darwin.gem

Stefano

Whoops. I went to this page:

http://rubyforge.org/frs/?group_id=35

and I downloaded:

wxruby-1.9.4-universal-darwin.gem

That hit my Desktop as:

wxruby-1.9.4-universal-darwin.gem.tar

and then I had the problems outlined in my first post.

7stud – wrote:

Stefano C. wrote:

This seems even more strange. The file wxruby-1.9.4.tar.gz is not the
gem
version, so, even if the file was automatically unzipped, it should be
called
wxruby-1.9.4.tar

If you want to use rubygems, you should download this file:
http://rubyforge.org/frs/download.php/30889/wxruby-1.9.4-universal-darwin.gem

then use

gem install wxruby-1.9.4-universal-darwin.gem

Stefano

Whoops. I went to this page:

http://rubyforge.org/frs/?group_id=35

and I downloaded:

wxruby-1.9.4-universal-darwin.gem

That hit my Desktop as:

wxruby-1.9.4-universal-darwin.gem.tar

and then I had the problems outlined in my first post.

I recall an article on this recently (I believe from the Apple Developer
Connection). Apparently, due to some form of server oddness, Safari
seems to tack on spurious .tar and .gz extensions. You should be able to
simple rename the file, removing the .tar, and install as normal.

Joshua B. wrote:

I recall an article on this recently (I believe from the Apple Developer
Connection). Apparently, due to some form of server oddness, Safari
seems to tack on spurious .tar and .gz extensions. You should be able to
simple rename the file, removing the .tar, and install as normal.

Ok, I renamed the file, but I don’t know how to “install as normal”
because I’ve never installed a local gem. When I try:

$ gem install /Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem

I get:

ERROR: could not find
/Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem locally or in a
repository

And when I try:

$ gem install wxruby-1.9.4-universal-darwin.gem

I get:

ERROR: could not find wxruby-1.9.4-universal-darwin.gem locally or in a
repository

7stud – wrote:

7stud – wrote:

And when I try:

$ gem install wxruby-1.9.4-universal-darwin.gem

I get:

ERROR: could not find wxruby-1.9.4-universal-darwin.gem locally or in a
repository

I was at the Desktop directory when I tried that:

~/Desktop$ gem install wxruby-1.9.4-universal-darwin.gem

try either

‘gem install wxruby-1.9.4-universal-darwin.gem’

or

‘gem install wxruby -l -v 1.9.4’

7stud – wrote:

And when I try:

$ gem install wxruby-1.9.4-universal-darwin.gem

I get:

ERROR: could not find wxruby-1.9.4-universal-darwin.gem locally or in a
repository

I was at the Desktop directory when I tried that:

~/Desktop$ gem install wxruby-1.9.4-universal-darwin.gem

On Jan 31, 11:34 pm, 7stud – [email protected] wrote:

I was at the Desktop directory when I tried that:

~/Desktop$ gem install wxruby-1.9.4-universal-darwin.gem

To be sure, could you output the listing of your desktop? (You’re sure
there’s a file there with that exact name? Tab-completed it, did you?)

7stud – wrote:

Hi,

I downloaded the file:

wxruby-1.9.4-universal-darwin.gem.tar

How do I install that?

on os x rename filename.gem.tar to filename.gem and install gem install
filename.gem

regards
D

Joshua B. wrote:

7stud – wrote:

Stefano C. wrote:

This seems even more strange. The file wxruby-1.9.4.tar.gz is not the
gem
version, so, even if the file was automatically unzipped, it should be
called
wxruby-1.9.4.tar

If you want to use rubygems, you should download this file:
http://rubyforge.org/frs/download.php/30889/wxruby-1.9.4-universal-darwin.gem

then use

gem install wxruby-1.9.4-universal-darwin.gem

Stefano

Whoops. I went to this page:

http://rubyforge.org/frs/?group_id=35

and I downloaded:

wxruby-1.9.4-universal-darwin.gem

That hit my Desktop as:

wxruby-1.9.4-universal-darwin.gem.tar

and then I had the problems outlined in my first post.

I recall an article on this recently (I believe from the Apple Developer
Connection). Apparently, due to some form of server oddness, Safari
seems to tack on spurious .tar and .gz extensions. You should be able to
simple rename the file, removing the .tar, and install as normal.

I finally got around to messing with this install again, and this time I
was able to successfully install wxruby thanks to the advice given here.
I installed the latest wxruby 2.0 instead of the version mentioned in my
earlier posts. I successfully installed the wxruby 2.0 gem which says
it’s for darwin-9 even though my system is darwin-8:

$ ruby -v
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]

I got this error trying to install:

$ tar -xvf /Users/me/Desktop/wxruby-2.0.0-universal-darwin-9.gem.tar
data.tar.gz
tar: data.tar.gz: implausibly old time stamp 1969-12-31 17:00:00
metadata.gz
tar: metadata.gz: implausibly old time stamp 1969-12-31 17:00:00
$

so I changed the filename on my Desktop to:

wxruby-2.0.0-universal-darwin-9.gem

i.e. I removed the .tar extension on the end. Then I changed
directories
to my Desktop:

$ cd ~/Desktop

and then commanded:

~/Desktop$ gem install wxruby-2.0.0-universal-darwin-9.gem

and I immediately got a message that said wxruby installed successfully.
Wow that was fast.

Ok, now to test the install. I found a basic wxruby example here:

http://book.opensourceproject.org.cn/lamp/ruby/cookbook/opensource/0596523696/rubyckbk-chp-21-sect-14.html

Instead of typing in the whole example, I decided to see if requiring
wxruby would work first.

r1test.rb

require ‘wxruby’

Nope:

r1test.rb:1:in `require’: No such file to load – wxruby (LoadError)
from r1test.rb:1

Oh yeah, there’s some ruby gem weirdness about requires. Checking my
notes in pickaxe2, I came up with this:

require ‘rubygems’
require ‘wxruby’

Still didn’t work:

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': No such file to load -- wxruby (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in require’
from r1test.rb:2

Hmm…the basic example at the link above mentions a tutorial here:

http://wxruby.rubyforge.org/wiki/wiki.pl?Getting_Started

Ahh, the tutorial uses:

require ‘wx’

Nope:

r1test.rb:1:in `require’: No such file to load – wx (LoadError)
from r1test.rb:1

Ok, how about:

require ‘rubygems’
require ‘wx’

That worked. On to the example:

require ‘rubygems’
require ‘wx’
include Wx

class TroutApp < App
def on_init
frame = Frame.new(nil, -1, “Title”)
text = StaticText.new(frame, -1, “You are a trout!”,
Point.new(-1, 1), DEFAULT_SIZE, ALIGN_CENTER)
frame.show
end
end

TroutApp.new.main_loop

And that worked.

Thanks for all the help.

Joshua B. wrote:

You’re welcome!

Your post was the key to the puzzle. Thank you.

You’re welcome!

7stud – wrote:

Joshua B. wrote:

You’re welcome!

Your post was the key to the puzzle. Thank you.

Ok. I decided to go for broke and upgrade from ruby 1.8.2 to ruby
1.8.6. I followed the Hivelogic instructions here:

and everything seemed to install correctly. And the new version is
being found:

$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.11.1]

I also upgraded from rubygems 0.9.4 to rubygems 1.3.1 following the
Hivelogic instructions.

But now when I try to require wxruby, I get an error:

r1test.rb

require ‘rubygems’
require ‘wx’

$ ruby r1test.rb
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require': no such file to load -- wx (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’
from r1test.rb:2

I tried all of the following as well:

require ‘wx’

require ‘rubygems’
require ‘wxruby’

require ‘wxruby’

I got an error for each one.

My PATH is a little different than instructed. Here are the last few
lines in my ~/.bash_profile file:



PATH=“/usr/local/bin:$PATH”
export PATH

PATH=“/usr/local/sbin:$PATH” "added for ruby 1.8.6 install
export PATH

Because /usr/local/bin was already on the front of the path in the
previous setting, I just added /usr/local/sbin to the front of the path.
I didn’t think that would cause any adverse affects.

My question is: where did wxruby go? What happened when I did this:

and then commanded:

~/Desktop$ gem install wxruby-2.0.0-universal-darwin-9.gem

Here is some more information:

$ gem environment gemdir
/usr/local/lib/ruby/gems/1.8

$ cd /usr/local/lib/ruby/gems/1.8

… /usr/local/lib/ruby/gems/1.8$ ls -al
total 0
drwxrwxr-x 6 root wheel 204 Mar 2 2008 .
drwxrwxr-x 3 root wheel 102 Jul 8 2007 …
drwxrwxr-x 10 root wheel 340 Feb 11 2008 cache
drwxr-xr-x 11 root wheel 374 Mar 25 02:15 doc
drwxrwxr-x 10 root wheel 340 Mar 2 2008 gems
drwxrwxr-x 10 root wheel 340 Mar 2 2008 specifications

… /usr/local/lib/ruby/gems/1.8$ cd gems

… /usr/local/lib/ruby/gems/1.8/gems$ ls -al
total 0
drwxrwxr-x 10 root wheel 340 Mar 2 2008 .
drwxrwxr-x 6 root wheel 204 Mar 2 2008 …
drwxr-xr-x 14 root wheel 476 Jan 27 2008 fastercsv-1.2.3
drwxr-xr-x 9 root wheel 306 Feb 11 2008 hoe-1.5.0
drwxr-xr-x 11 root wheel 374 Jan 27 2008 hpricot-0.6
drwxr-xr-x 11 root wheel 374 Jan 27 2008 libxml-ruby-0.5.2.0
drwxr-xr-x 14 root wheel 476 Feb 11 2008 mechanize-0.7.0
drwxr-xr-x 12 root wheel 408 Feb 11 2008 rake-0.8.1
drwxr-xr-x 9 root wheel 306 Feb 11 2008 rubyforge-0.4.4
drwxr-xr-x 19 root wheel 646 Jan 27 2008 rubygems-update-1.0.1
… /usr/local/lib/ruby/gems/1.8/gems$

7stud – wrote:

Here is some more information:

Oh, yeah:

$ gem -v
1.3.1

On Mar 25, 2009, at 01:56, 7stud – wrote:

Here is some more information:

$ gem environment gemdir
/usr/local/lib/ruby/gems/1.8

Compare the RUBY EXECUTABLE entry from gem env to which ruby

7stud – wrote:

Eric H. wrote:

On Mar 25, 2009, at 01:56, 7stud – wrote:

Here is some more information:

$ gem environment gemdir
/usr/local/lib/ruby/gems/1.8

Compare the RUBY EXECUTABLE entry from gem env to which ruby

I also did this:

$ find /usr -name ‘wxruby*’
/usr/lib/ruby/gems/1.8/cache/wxruby-2.0.0-universal-darwin-9.gem
/usr/lib/ruby/gems/1.8/doc/wxruby-2.0.0-universal-darwin-9
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.0-universal-darwin-9
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.0-universal-darwin-9/lib/wxruby2.bundle
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.0-universal-darwin-9/samples/drawing/wxruby-logo.png
/usr/lib/ruby/gems/1.8/specifications/wxruby-2.0.0-universal-darwin-9.gemspec
find: /usr/local/mysql-5.0.41-osx10.4-i686/data: Permission denied

$ cd /usr/lib/ruby/gems/1.8/gems
/usr/lib/ruby/gems/1.8/gems$ ls -al
total 0
drwxr-xr-x 10 root wheel 340 Mar 24 01:31 .
drwxr-xr-x 7 root wheel 238 Oct 7 2007 …
drwxr-xr-x 14 root wheel 476 Oct 8 2007 fastercsv-1.2.1
drwxr-xr-x 17 root wheel 578 Nov 23 2007 json-1.1.1
drwxr-xr-x 10 root wheel 340 Oct 20 2007 libxml-ruby-0.5.2.0
drwxr-xr-x 12 root wheel 408 Oct 7 2007 rake-0.7.3
drwxr-xr-x 8 root wheel 272 Nov 23 2007 ruby-json-1.1.2
drwxr-xr-x 19 root wheel 646 Jan 25 2008 rubygems-update-1.0.0
drwxr-xr-x 3 root wheel 102 Oct 7 2007 sources-0.0.1
drwxr-xr-x 7 root wheel 238 Mar 24 01:31
wxruby-2.0.0-universal-darwin-9

Eric H. wrote:

On Mar 25, 2009, at 01:56, 7stud – wrote:

Here is some more information:

$ gem environment gemdir
/usr/local/lib/ruby/gems/1.8

Compare the RUBY EXECUTABLE entry from gem env to which ruby

$ gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.1
  • RUBY VERSION: 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.11.1]
  • INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: /usr/local/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-darwin-8
  • GEM PATHS:
    • /usr/local/lib/ruby/gems/1.8
    • /Users/me/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

$ which ruby
/usr/local/bin/ruby

7stud – wrote:

7stud – wrote:

Eric H. wrote:

On Mar 25, 2009, at 01:56, 7stud – wrote:

Here is some more information:

$ gem environment gemdir
/usr/local/lib/ruby/gems/1.8

Compare the RUBY EXECUTABLE entry from gem env to which ruby

I also did this:

$ find /usr -name ‘wxruby*’
/usr/lib/ruby/gems/1.8/cache/wxruby-2.0.0-universal-darwin-9.gem
/usr/lib/ruby/gems/1.8/doc/wxruby-2.0.0-universal-darwin-9
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.0-universal-darwin-9
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.0-universal-darwin-9/lib/wxruby2.bundle
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.0-universal-darwin-9/samples/drawing/wxruby-logo.png
/usr/lib/ruby/gems/1.8/specifications/wxruby-2.0.0-universal-darwin-9.gemspec
find: /usr/local/mysql-5.0.41-osx10.4-i686/data: Permission denied

$ cd /usr/lib/ruby/gems/1.8/gems
/usr/lib/ruby/gems/1.8/gems$ ls -al
total 0
drwxr-xr-x 10 root wheel 340 Mar 24 01:31 .
drwxr-xr-x 7 root wheel 238 Oct 7 2007 …
drwxr-xr-x 14 root wheel 476 Oct 8 2007 fastercsv-1.2.1
drwxr-xr-x 17 root wheel 578 Nov 23 2007 json-1.1.1
drwxr-xr-x 10 root wheel 340 Oct 20 2007 libxml-ruby-0.5.2.0
drwxr-xr-x 12 root wheel 408 Oct 7 2007 rake-0.7.3
drwxr-xr-x 8 root wheel 272 Nov 23 2007 ruby-json-1.1.2
drwxr-xr-x 19 root wheel 646 Jan 25 2008 rubygems-update-1.0.0
drwxr-xr-x 3 root wheel 102 Oct 7 2007 sources-0.0.1
drwxr-xr-x 7 root wheel 238 Mar 24 01:31 wxruby-2.0.0-universal-darwin-9

I also tried installing a gem to see what would happen:

$ gem install -r BlueCloth
WARNING: Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and
/usr/local/bin aren’t both writable.
WARNING: You don’t have /Users/me/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
Successfully installed BlueCloth-1.0.0
1 gem installed