I updated ruby and rubygems and now no more wxruby

I installed wxruby like this:

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

and I got a message that said wxruby installed successfully. I tested a
simple wxruby program, and I got that to work.

Then I upgraded from ruby 1.8.2 to ruby 1.8.6. I followed the Hivelogic
instructions here:

and everything seemed to install correctly.

$ 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. I downloaded
rubygems 1.3.1 and installed locally:

/usr/local/src$ ls -al
total 15968
drwxrwxr-x 7 root admin 238 Mar 25 02:13 .
drwxr-xr-x 12 root wheel 408 Mar 24 00:09 …
drwxr-xr-x 113 me admin 3842 Mar 24 01:08 readline-6.0
-rw-r–r-- 1 me admin 2270818 Mar 24 00:21 readline-6.0.tar.gz
drwxr-xr-x 154 me admin 5236 Mar 25 02:02 ruby-1.8.6
-rw-r–r-- 1 me admin 4589394 Mar 24 00:52 ruby-1.8.6.tar.gz
-rw-r–r-- 1 me me 1310720 Feb 24 11:00 rubygems-1.3.1.tar

/usr/local/src$ tar -xvf rubygems-1.3.1.tar
/usr/local/src$ cd rubygems-1.3.1
/usr/local/src/rubygems-1.3.1$ sudo /usr/local/bin/ruby setup.rb

$ gem -v
1.3.1

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 in the Hivelogic instructions. 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 tacked onto 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:

~/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$

$ 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/autie/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

Hello 7stud,

On Wed, Mar 25, 2009 at 12:04 PM, 7stud – [email protected] wrote:

/usr/local/src$ ls -al
/usr/local/src$ cd rubygems-1.3.1
require ‘rubygems’

I got an error for each one.
PATH=“/usr/local/bin:$PATH”

$ cd /usr/local/lib/ruby/gems/1.8
… /usr/local/lib/ruby/gems/1.8$ cd gems
drwxr-xr-x 12 root wheel 408 Feb 11 2008 rake-0.8.1

  • RUBY EXECUTABLE: /usr/local/bin/ruby
    • :benchmark => false

More then likely, wxruby is in the previous gem’s directory, where you
had
0.9.7 of rubygems installed. If you poped off the /usr/local/bin and
/usr/local/sbin path from your PATH variable, and do a gem list --local,
you’ll find wxruby is installed there, so you need to re-do the gem
install
wxruby-2.0.0-universal-darwin-9.gem

Mario S. wrote:

Hello 7stud,

On Wed, Mar 25, 2009 at 12:04 PM, 7stud – [email protected] wrote:

/usr/local/src$ ls -al
/usr/local/src$ cd rubygems-1.3.1
require ‘rubygems’

I got an error for each one.
PATH=“/usr/local/bin:$PATH”

$ cd /usr/local/lib/ruby/gems/1.8
… /usr/local/lib/ruby/gems/1.8$ cd gems
drwxr-xr-x 12 root wheel 408 Feb 11 2008 rake-0.8.1

  • RUBY EXECUTABLE: /usr/local/bin/ruby
    • :benchmark => false

More then likely, wxruby is in the previous gem’s directory, where you
had
0.9.7 of rubygems installed. If you poped off the /usr/local/bin and
/usr/local/sbin path from your PATH variable, and do a gem list --local,
you’ll find wxruby is installed there,

Thanks for the response. I removed the following lines from my
~/.bash_profile file:



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

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

Then did:

$ . ~/.bash_profile

Then I closed all my Terminal windows, and opened a new Terminal window
and typed:

$ gem list --local

*** LOCAL GEMS ***

fastercsv (1.2.1)
FasterCSV is CSV, but faster, smaller, and cleaner.

json (1.1.1)
A JSON implementation as a Ruby extension

rake (0.7.3)
Ruby based make-like utility.

ruby-json (1.1.2)
ruby-json is a library for using JavaScript Object Notation (JSON)
under Ruby.

rubygems-update (1.0.0)
RubyGems Update GEM

sources (0.0.1)
This package provides download sources for remote gem installation

wxruby (2.0.0)
Ruby interface to the wxWidgets GUI library

There it is. The last one. Those gems are different than the ones
listed here:

… /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

So I ran a find to figure out where wxruby was located:

$ 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

And then:

$ 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

So why are some gems in /usr/lib while other gems are in /usr/local/lib?
Where should they be?

Well, the reason why you had to follow the Hive Logic guide to upgrade
the
versions of Ruby and RubyGems installed, is cause there are some
components,
I don’t know which, of Mac OS X, that utitlize Ruby, and attempting to
upgrade Ruby in thoes areas, can mess up your system. What happens, is
that
the system’s copy of Ruby, is installed to /usr.

Meaning, Libraries are installed in /usr/lib, Binaries are in /usr/bin,
Includes are in /usr/include, etc, etc. Where as the HiveLogic guide
has
you installing Ruby into /usr/local, meaning Libraries are installed in
/usr/local/lib, Binaries are in /usr/local/bin, Includes are in
/usr/local/include, etc, etc.

So as you can see, you have an instance of two different copies of Ruby
being installed onto your hard drive, in two different areas. If you
want
to take the chance, and install Ruby into the /usr folder and such,
follow
the guide up to the point where you do the ./configure, and instead add
the
following switch, ./configure --prefix=/usr

With that, it’ll install all binaries, libraries, include headers, and
such
into the /usr folder of your system path. But you will ofcourse need to
do
this as the Super User Root.

Otherwise, you can just continue to do what you have right now, and
re-add
the /usr/local/bin and /usr/local/sbin back to your .bashrc, and just
re-run
gem install wxruby-2.0.0-universal-darwin-9.gem

hth,

Mario

Mario S. wrote:

Well, the reason why you had to follow the Hive Logic guide to upgrade
the
versions of Ruby and RubyGems installed, is cause there are some
components,
I don’t know which, of Mac OS X, that utitlize Ruby, and attempting to
upgrade Ruby in thoes areas, can mess up your system. What happens, is
that
the system’s copy of Ruby, is installed to /usr.

Meaning, Libraries are installed in /usr/lib, Binaries are in /usr/bin,
Includes are in /usr/include, etc, etc. Where as the HiveLogic guide
has
you installing Ruby into /usr/local, meaning Libraries are installed in
/usr/local/lib, Binaries are in /usr/local/bin, Includes are in
/usr/local/include, etc, etc.

So as you can see, you have an instance of two different copies of Ruby
[on] your hard drive, in two different areas.

Ok. But I still don’t understand the gems. I just installed ruby 1.8.6
(and rubygems 1.3.1), so it seems to me there shouldn’t be a single gem
under the path /usr/local/lib. Yet, there is a whole directory of them:

… /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

and they aren’t the same gems as the gems for the system install of ruby
1.8.2 that are under /usr/lib

$ 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

And as a test, I tried installing the BlueCloth gem, which was my first
attempt to install a gem with ruby 1.8.6 and rubygems 1.3.1. I set my
path back to:

re-add
the /usr/local/bin and /usr/local/sbin back to your .bashrc

and this is what happened:

$ 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

At this point, I am totally fed up with rubygems AND ruby. I don’t
understand why this is so complicated. NOTHING seems to work the way it
should.

If you
want
to take the chance, and install Ruby into the /usr folder and such,

No, I don’t want to do that. ruby and rubygems have already done enough
damage to my psyche. I don’t want to give them the chance to mess up
my hardware.

Otherwise, you can just continue to do what you have right now, and
re-add
the /usr/local/bin and /usr/local/sbin back to your .bashrc, and just
re-run
gem install wxruby-2.0.0-universal-darwin-9.gem

Since BlueCloth didn’t install properly, I’m not sure what to do at this
point. Try perl?

Since BlueCloth didn’t install properly, I’m not sure what to do at this
point. Try perl?

Just to point out, if your having these troubles with Ruby, you’ll have
the
same problems with Perl, cause Perl does the same exact thing as Ruby,
only
more involved, with a bunch of more prompts then RubyGems, with CPAN. I
did
a system upgrade of all the Perl libraries on my laptop, and I sat there
for
about an hour, answering Yes to a bunch of prompts that asked if I
wanted to
upgrade this package, cause it has these dependencies, and if I wanted
to
add it to the queue. And kept doing this, over and over, and over
again.
Kinda annoying if you ask me, since I specifically requested from CPAN
to
upgrade all the packages on my laptop.

Just try what I stated in my previous email, and you shouldn’t have any
problems.

On Thu, Mar 26, 2009 at 10:11 PM, 7stud – [email protected] wrote:

Meaning, Libraries are installed in /usr/lib, Binaries are in /usr/bin,
(and rubygems 1.3.1), so it seems to me there shouldn’t be a single gem
drwxr-xr-x 14 root wheel 476 Feb 11 2008 mechanize-0.7.0
drwxr-xr-x 10 root wheel 340 Mar 24 01:31 .

This part, I can’t explain. I don’t know why there are gems in
/usr/local/lib/gems/1.8/gems, if you didn’t execute any gem command to
install anything. But the point still remains why there are two sets of
areas where RubyGems looks for the actual gem stuff. When you have your
/usr/local/bin in your Path, especially the way you have it defined,
export
PATH=“/usr/local/bin:$PATH”, Bash will look in /usr/local/bin every
single
time you execute a commmand first, to see if it can find the binary, or
shell script there, if not, then it goes to the next entry in the $PATH
environment variable. So, for an example as the best way I can explain
it
to you, is to do this:

Without modifying your .bashrc, and keeping the /usr/local/bin in there,
type the following:

which ruby

You should get an output like this:

/usr/local/bin/ruby

Which means, that Ruby will look in /usr/local/lib/ruby/* for all
libraries,
even for RubyGems.

Now, if you modify your .bashrc, and remove the /usr/local/bin from
there,
then type the following:

which ruby

You should get an output like this:

/usr/bin/ruby

Which means that Ruby will look in /usr/lib/ruby/* for all libraries,
even
for RubyGems.

Hence why, if you have the /usr/local/bin in your $PATH environment
variable, it will ignore looking in /usr/lib/ruby/, cause as far as it
is
concerned, all the stuff it needs, is in /usr/local/lib/ruby/
. This is
simple Operating System stuff.

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

At this point, I am totally fed up with rubygems AND ruby. I don’t
understand why this is so complicated. NOTHING seems to work the way it
should.

At this point, RubyGems can’t write to the path
/usr/local/lib/ruby/gems/1.8/, so as a fall back, it installs the gems
into
your Home path, EG: /Users/me/.gem/ruby/1.8/
The reason for this, is
cause
there is a Super User that can only write to folders outside your home
directory, and that is Root. No one else is allowed to write files in
that
folder, except for Root. There are other details involved, but I won’t
go
into that. Sufficent to say, that unless your the Root user, you can’t
write to thoes folders. There is a way to install them into the
/usr/local/lib folder, but to correctly do this, I’m going to have you
issue
2 commands. The first is to uninstall the BlueCloth gem you just
installed.

$ gem uninstall -r BlueCloth

Once that is done, then you need to do what we call a Set User and Do,
or
what we commonly refer to it as, is sudo. What this does, is allows you
for
the duration of the command your executing, to set yourself as another
user
on your computer, to execute the specified command. So, in this
command,
we’re going to do the same exact thing that you just did to install
BlueCloth, only slightly differently:

$ sudo gem install -r BlueCloth
[sudo] password for me:

That is what you SHOULD get. At this point, you type in your password,
to
allow the system to execute the command as the ROOT user. If you
notice,
when you do a ls of the /usr/local/lib/ruby/gems/1.8/gems/, you see a
bunch
of letters at the begining, a number, then the next two entries are root
and
wheel. Well, root is the user, and wheel is the group. Sufficent to
say,
root is the only one that can write to this directory, and hence why you
need to do the sudo, in order to install to this path.

If you
want
to take the chance, and install Ruby into the /usr folder and such,

No, I don’t want to do that. ruby and rubygems have already done enough
damage to my psyche. I don’t want to give them the chance to mess up
my hardware.

You mis understand by what I meant. It doesn’t mess up your hardware,
at
the worst possible case, 2 or 3 applications that use Ruby on your
system,
would stop working, if they aren’t able to work with Ruby 1.8.6, instead
of
the version you actually have installed by default. It never actually
messes up your actual computer hardware.

Otherwise, you can just continue to do what you have right now, and
re-add
the /usr/local/bin and /usr/local/sbin back to your .bashrc, and just
re-run
gem install wxruby-2.0.0-universal-darwin-9.gem

Since BlueCloth didn’t install properly, I’m not sure what to do at this
point. Try perl?

Try my instructions above, about doing sudo, you’ll find that it will
work
this way, and if BlueCloth installs, then do the same process to install
wxRuby, EG:

$ sudo gem install wxruby-2.0.0-universal-darwin-9.gem

Don’t use any gem command that installs, or removes files, without using
the
sudo, cause otherwise, gem will not be able to access the files.

hth,

Mario

7stud – wrote:

And as a test, I tried installing the BlueCloth gem, which was my first
attempt to install a gem with ruby 1.8.6 and rubygems 1.3.1. I set my
path back to:

re-add
the /usr/local/bin and /usr/local/sbin

…in the file ~/.bash_login

and this is what happened:

$ 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

Here are the permissions for the various directories mentioned in the
error message:

/usr/local/lib/ruby/gems$ ls -al
total 0
drwxrwxr-x 3 root wheel 102 Jul 8 2007 .
drwxr-xr-x 5 root wheel 170 Mar 25 02:02 …
drwxrwxr-x 6 root wheel 204 Mar 2 2008 1.8 <----****

/usr/local$ ls -al
total 16
drwxr-xr-x 12 root wheel 408 Mar 24 00:09 .
drwxr-xr-x 11 root wheel 374 Mar 17 23:50 …
drwxr-xr-x 62 root wheel 2108 Mar 25 02:15 bin <-----****

~$ ls -al

drwxr-xr-x 4 me me 136 Mar 25 02:23 .gem <-----****

It looks like the directories:

/usr/local/lib/ruby/gems/1.8
/usr/local/bin

have the same or more liberal permissions than the directory:

~/.gem

yet gem said it couldn’t install in those directories??

Mario S. wrote:

On Thu, Mar 26, 2009 at 10:11 PM, 7stud – [email protected] wrote:

Meaning, Libraries are installed in /usr/lib, Binaries are in /usr/bin,
(and rubygems 1.3.1), so it seems to me there shouldn’t be a single gem
drwxr-xr-x 14 root wheel 476 Feb 11 2008 mechanize-0.7.0
drwxr-xr-x 10 root wheel 340 Mar 24 01:31 .

This part, I can’t explain. I don’t know why there are gems in
/usr/local/lib/gems/1.8/gems, if you didn’t execute any gem command to
install anything. But the point still remains why there are two sets of
areas where RubyGems looks for the actual gem stuff.

Yes, I understand what you are saying.

When you have your
/usr/local/bin in your Path, especially the way you have it defined,
export
PATH=“/usr/local/bin:$PATH”, Bash will look in /usr/local/bin every
single
time you execute a commmand first, to see if it can find the binary, or
shell script there, if not, then it goes to the next entry in the $PATH
environment variable.

Yes. I understand that.

So, for an example as the best way I can explain
it
to you, is to do this:

Without modifying your .bashrc, and keeping the /usr/local/bin in there,
type the following:

which ruby

You should get an output like this:

/usr/local/bin/ruby

Yes, this is what I get:

$ which ruby
/usr/local/bin/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 means, that Ruby will look in /usr/local/lib/ruby/* for all
libraries,
even for RubyGems.

Ok.

Now, if you modify your .bashrc,

I have my PATH stuff in ~/.bash_profile, which as far as I know affects
bash shells–instead of all shells. I only use bash shells.

and remove the /usr/local/bin from
there,
then type the following:

which ruby

You should get an output like this:

/usr/bin/ruby

$ which ruby
/usr/bin/ruby

$ gem env
RubyGems Environment:

  • VERSION: 0.9.4 (0.9.4)
  • INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  • GEM PATH:
    • /usr/lib/ruby/gems/1.8
  • REMOTE SOURCES:

Which means that Ruby will look in /usr/lib/ruby/* for all libraries,
even
for RubyGems.

Yes, I understand. The two different gem directories are specified as:

with /usr/local/bin on the front of my PATH:

  • GEM PATHS:
    • /usr/local/lib/ruby/gems/1.8
    • /Users/me/.gem/ruby/1.8

without /usr/local/bin on the front of my PATH

  • GEM PATH:
    • /usr/lib/ruby/gems/1.8

Hence why, if you have the /usr/local/bin in your $PATH environment
variable, it will ignore looking in /usr/lib/ruby/, cause as far as it
is
concerned, all the stuff it needs, is in /usr/local/lib/ruby/
. This is
simple Operating System stuff.

Yes, I understand.

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

At this point, I am totally fed up with rubygems AND ruby. I don’t
understand why this is so complicated. NOTHING seems to work the way it
should.

At this point, RubyGems can’t write to the path
/usr/local/lib/ruby/gems/1.8/, so as a fall back, it installs the gems
into
your Home path, EG: /Users/me/.gem/ruby/1.8/
The reason for this, is
cause
there is a Super User that can only write to folders outside your home
directory, and that is Root. No one else is allowed to write files in
that
folder, except for Root.

Ahh, yes. I even have a note in the gem section of pickaxe2 to remember
to use sudo when installing gems. I didn’t remember to do that.

There are other details involved, but I won’t
go
into that. Sufficent to say, that unless your the Root user, you can’t
write to thoes folders. There is a way to install them into the
/usr/local/lib folder, but to correctly do this, I’m going to have you
issue
2 commands. The first is to uninstall the BlueCloth gem you just
installed.

$ gem uninstall -r BlueCloth

That’s not working:

$ gem uninstall -r BlueCloth
ERROR: While executing gem … (OptionParser::InvalidOption)
invalid option: -r

$ gem uninstall BlueCloth
ERROR: While executing gem … (Gem::InstallError)
Unknown gem BlueCloth >= 0

$ gem query --local

*** LOCAL GEMS ***

BlueCloth (1.0.0)
fastercsv (1.2.3)
hoe (1.5.0)
hpricot (0.6)
libxml-ruby (0.5.2.0)
mechanize (0.7.0)
rake (0.8.1)
rubyforge (0.4.4)
rubygems-update (1.0.1)

$ which ruby
/usr/local/bin/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:

7stud – wrote:

That’s not working:

$ gem uninstall -r BlueCloth
ERROR: While executing gem … (OptionParser::InvalidOption)
invalid option: -r

$ gem uninstall BlueCloth
ERROR: While executing gem … (Gem::InstallError)
Unknown gem BlueCloth >= 0

I bet it has something to do with the warning I got when I installed
BlueCloth:

WARNING: You don’t have /Users/me/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.

But I don’t have any such directory:

~/.gem/ruby/1.8$ ls -al
total 0
drwxr-xr-x 6 me me 204 Mar 25 02:23 .
drwxr-xr-x 3 me me 102 Mar 25 02:23 …
drwxr-xr-x 3 me me 102 Mar 26 07:30 cache
drwxr-xr-x 3 me me 102 Mar 26 07:30 doc
drwxr-xr-x 3 me me 102 Mar 26 07:30 gems
drwxr-xr-x 3 me me 102 Mar 26 07:30 specifications

Actually, at this point, you could probably just go ahead, and do a rm
-rf
~/.gem to get rid of it, and then do the sudo gem install for the blue
cloth.

What’s the difference between uninstalling a gem and cd’ing to the
directory it resides in and removing it?

Mario S. wrote:

Actually, at this point, you could probably just go ahead, and do a rm
-rf
~/.gem to get rid of it, and then do the sudo gem install for the blue
cloth.

I just cross posted this problem to the main ruby forum:

http://www.ruby-forum.com/topic/182708#new

Mario S. wrote:

Actually, at this point, you could probably just go ahead, and do a rm
-rf
~/.gem to get rid of it, and then do the sudo gem install for the blue
cloth.

I’m not sure deleting ~/.gem and BlueCloth did anything helpful, but now
I’ve got wxruby working again. The details are in the other thread.