Forum: Ruby how do you install a local gem?

54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2008-01-31 23:01
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

???
C40020a47c6b625af6422b5b1302abaf?d=identicon&s=25 Stefano Crocco (crocco)
on 2008-01-31 23:11
(Received via mailing list)
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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2008-01-31 23:37
Stefano Crocco 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...

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

/Users/me/Desktop/wxruby-1.9.4-universal-darwin.gem.tar
C40020a47c6b625af6422b5b1302abaf?d=identicon&s=25 Stefano Crocco (crocco)
on 2008-01-31 23:48
(Received via mailing list)
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...
>
> 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...

then use

gem install wxruby-1.9.4-universal-darwin.gem

Stefano
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2008-02-01 01:10
Stefano Crocco 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...
>
> 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.
E8a419959139f3f505b49bb95f7e7afe?d=identicon&s=25 Joshua Ballanco (jballanc)
on 2008-02-01 02:19
7stud -- wrote:
> Stefano Crocco 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...
>>
>> 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.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2008-02-01 04:38
Joshua Ballanco 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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2008-02-01 07:34
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
E8a419959139f3f505b49bb95f7e7afe?d=identicon&s=25 Joshua Ballanco (jballanc)
on 2008-02-01 20:27
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'
852a62a28f1de229dc861ce903b07a60?d=identicon&s=25 Gavin Kistner (phrogz)
on 2008-02-01 21:00
(Received via mailing list)
On Jan 31, 11:34 pm, 7stud -- <bbxx789_0...@yahoo.com> 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?)
19c443457f040c942bebec8e7d11f771?d=identicon&s=25 Daniel Gona (noburo)
on 2009-02-02 03:39
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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-24 09:28
Joshua Ballanco wrote:
> 7stud -- wrote:
>> Stefano Crocco 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...
>>>
>>> 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/coo...

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.
E8a419959139f3f505b49bb95f7e7afe?d=identicon&s=25 Joshua Ballanco (jballanc)
on 2009-03-24 18:24
(Received via mailing list)
You're welcome!
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-25 06:25
Joshua Ballanco wrote:
> You're welcome!

Your post was the key to the puzzle.  Thank you.
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-25 10:00
7stud -- wrote:
> Joshua Ballanco 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:

http://hivelogic.com/articles/2007/02/ruby-rails-m...

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$
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-25 10:02
7stud -- wrote:
>
> Here is some more information:
>

Oh, yeah:

$ gem -v
1.3.1
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2009-03-25 19:06
(Received via mailing list)
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`
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-26 09:14
Eric Hodel 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:
     - http://gems.rubyforge.org/

$ which ruby
/usr/local/bin/ruby
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-26 09:32
7stud -- wrote:
> Eric Hodel 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
54404bcac0f45bf1c8e8b827cd9bb709?d=identicon&s=25 7stud -- (7stud)
on 2009-03-26 14:46
7stud -- wrote:
> 7stud -- wrote:
>> Eric Hodel 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.