Getting Started w Ruby on MacOSX -- ri/RDoc error

M

M. Norton

Hello,

I've done some poking around and haven't yet found a satisfactory
answer to this problem and it's starting to be troublesome.

My development machine run MacOSX and I've installed Ruby 1.9.1 via
the MacPorts options. This puts everything into /opt/local and tags
executables with the version number (e.g. ruby becomes ruby1.9, ri
becomes ri1.9, etc.)

When I run ri to browse a class documentation, I get the following
error:

galactica:~ remillard$ ri GC
/opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:384:in `initialize':
Permission denied - /Users/remillard/.ri1.9/cache/.doc_dirs
(Errno::EACCES)
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:384:in `open'
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:384:in
`create_class_cache'
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:371:in
`class_cache'
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:591:in `block in
run'
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:590:in `each'
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:590:in `run'
from /opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:300:in `run'
from /opt/local/bin/ri:5:in `<main>'

Now, my best guess is that there's something funny about the paths
where MacPorts installed things, but I'll be damned if I can figure
out what's going on. When looking at my path I see:

galactica:~ remillard$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/
local/bin:/usr/X11/bin:/Users/remillard/bin

And it looks to me like the MacPorts path should be searched first.
The only thing I did was to go into /opt/local/bin and symlink the
simple names to the versioned names for convenience. However I still
get the same error if I run "ri1.9 GC" so I don't think the symlinks
are causing any trouble.

Has anyone run into this with MacPorts, Ruby 1.9 and MacOSX?

Thanks for any information and help the community can suggest.

Best regards,
Mark Norton
 
M

M. Norton

I did finally figure it out so I will document the answer here in case
it helps someone else.

Somewhere along the line with installing ruby, rails, and other gems,
the local ri cache was created and owned by root. I'm not entirely
sure why, but that explained the lack of permissions. If you get
errors similar to what I described above, check your local directory
"ls -al" and look to see if root owns .ri1.9/. Blow that away and
then rerun ri. It'll rebuild the cache and hopefully be owned by your
own self.

Hope this helps.

All the best,
Mark Norton
 
R

Ryan Davis

When I run ri to browse a class documentation, I get the following
error:
=20
galactica:~ remillard$ ri GC
/opt/local/lib/ruby1.9/1.9.1/rdoc/ri/driver.rb:384:in `initialize':
Permission denied - /Users/remillard/.ri1.9/cache/.doc_dirs
(Errno::EACCES)

Did you install the docs?
 
A

Aaron Broad

M. Norton said:
I did finally figure it out so I will document the answer here in case
it helps someone else.

Somewhere along the line with installing ruby, rails, and other gems,
the local ri cache was created and owned by root. I'm not entirely
sure why, but that explained the lack of permissions. If you get
errors similar to what I described above, check your local directory
"ls -al" and look to see if root owns .ri1.9/. Blow that away and
then rerun ri. It'll rebuild the cache and hopefully be owned by your
own self.

Hope this helps.

All the best,
Mark Norton

Hi,

Just wanted to let you know you helped someone. Ran into the exact same
problem on Mint linux today, and your post came up with a little
googling.

A simple "sudo chown -R aaron:aaron /home/aaron/.ri1.9.1/" saved the
day!

Aaron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top