Topic : Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!

Topic Archived This topic has been archived - replies are not allowed.


This question is answered. "Helpful" answers available: 1 . "Solved" answers available: 1 .



            Permlink
            Replies : 7 - Pages : 1 - Last Post : Nov 8, 2007 11:28 AM by: Nicholas Cancel...
Nicholas Cancel...

Posts: 49
From: Austin, TX
Registered: Jul 5, 2003
Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Oct 28, 2007 8:22 PM
 

After doing an gem update --system it seems that the whole out-of-box Ruby and Ruby on Rails experience in Leopard goes way south. :-(

I first had issues just trying to run the rails command:

Adenthir:Workspace nicholas$ rails dummy
/Library/Ruby/Site/1.8/rubygems.rb:304:in `report_activate_error': Could not find RubyGem rails (> 0) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems.rb:238:in `activate'
from /Library/Ruby/Site/1.8/rubygems.rb:76:in `active_gem_with_options'
from /Library/Ruby/Site/1.8/rubygems.rb:50:in `gem'
from /usr/bin/rails:15

I found that the directory path(s) of the gem repositories which were:

["/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8", "/Library/Ruby/Gems/1.8"]

had become simply:

["/Library/Ruby/Gems"]

So I added GEM_HOME and GEM_PATH to my .profile, and this works for when I'm in the shell.

However when I run Aptana or Netbeans it complains about the environment and not being able to find the rails 1.2.3 gem. It seems that not all was yet fixed by adding the paths to my .profile to help clear up the confusion about the missing gem repositories.

How do you get it so that applications that are not run from the shell eg. Aptana or NetBeans can see the same path as I'm getting in the shell? (My assumption is that the reason they error is because they don't use the .profile shell settings.) I'm not quite sure how to set environment variables for the Mac OS itself (other than the shell sessions). And I am not going to take "just run your apps using shell commands to start them" as an answer!

All my rails/ruby stuff was working flawlessly in 10.4 ...sigh.

Help!

MacBook Pro (intel)   Mac OS X (10.5)   iPhone, AirPort Extreme  
William Lloyd


Posts: 6,477
From: California
Registered: May 22, 2003
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Oct 28, 2007 8:26 PM   in response to: Nicholas Cancel...
 

Hmmm.

Leopard includes ROR support. Tiger did not.

So you had to install your own ROR install with Tiger, and when you upgraded it's likely the Leopard built-in version conflicts with it. You will need to set up your environments carefully to point to your install, unless you want to use the default one.

8-Core Mac Pro   Mac OS X (10.5)    
Nicholas Cancel...

Posts: 49
From: Austin, TX
Registered: Jul 5, 2003
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Oct 28, 2007 8:32 PM   in response to: William Lloyd
 

Actually - I paved my laptop knowing that I had done a lot of "hacking" to get RoR working with LightTPD etc. So I wanted to avoid any issues with conflicts.

I have a clean brand-new fresh install on the HD ... the only thing I did was execute a gem update --system (to make sure it was the latest and greatest, not knowing what Apple shipped it with etc). No errors were encountered with the gem update.

It messed up the gem repository paths though it would seem - from what Apple is using. I just need to figure out how to add GEM_HOME and GEM_PATH env variables to be recognized inside Mac OS X (not just inside a shell session).

If I run from the shell everything works fine using the command lines ... but I primarily code with NetBeans for my Rails stuff.

MacBook Pro (intel)   Mac OS X (10.5)   iPhone, AirPort Extreme  
Nicholas Cancel...

Posts: 49
From: Austin, TX
Registered: Jul 5, 2003
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Oct 28, 2007 9:16 PM   in response to: Nicholas Cancel...
 

Okay - I think I have the path situation sorted out. In order to get applications like NetBeans or Aptana to recognize the gem repositories after doing a gem update --system command you need to create a file ~/.MacOSX/environment.plist (it isn't there by default so you'll need to make one).

I used the plist editor tool that comes with XCode's installation, but I imagine any text editor will be sufficient. You will want to add the following to restore your paths for RubyGem:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GEM_HOME</key>
<string>/Library/Ruby/Gems/1.8</string>
<key>GEM_PATH</key>
<string>/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8</string>
</dict>
</plist>

That seems to of fixed the confusion that NetBeans was having for me as to where to find the gem for rails. Everything (so far) seem to be back to normal.

Just a word of caution - if you're going to do a gem update be ready for some downtime as you fix your environment paths.

MacBook Pro (intel)   Mac OS X (10.5)   iPhone, AirPort Extreme  
William Lloyd


Posts: 6,477
From: California
Registered: May 22, 2003
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Oct 28, 2007 9:19 PM   in response to: Nicholas Cancel...
 

Glad you figured it out; my development days are behind me and I'm just not the XML and path guy I used to be. It's not like riding a bike ;-)

Note that "any text editor" won't suffice for editing plist files... reason being starting with Tiger the default for plist files was actually binary (and not plain text) given it's faster and more efficient to load them. So in may cases opening a plist file with a text editor will just show you garbledygook. There is a command line tool which can convert between binary and text plist formats... but it escapes me. Apropos would be my friend :-)

8-Core Mac Pro   Mac OS X (10.5)    
Nicholas Cancel...

Posts: 49
From: Austin, TX
Registered: Jul 5, 2003
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Oct 28, 2007 9:28 PM   in response to: William Lloyd
 

I created the file initially with the plist editor tool, but then did subsequent edits using TextMate -- either you can edit them with text editors or TextMate (being the awesome app it is) understands how to read and convert them to XML.

I don't know if I'm out of the woods yet -- but I am sharing my solutions so that if/when others have similar issues they hopefully find answers.

MacBook Pro (intel)   Mac OS X (10.5)   iPhone, AirPort Extreme  
james2m

Posts: 2
From: Brighton, UK
Registered: Aug 10, 2007
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Nov 8, 2007 11:00 AM   in response to: Nicholas Cancel...
Helpful

Could just create a .gemrc under your home directory and put this in it;

gemhome:
  • /Library/Ruby/Gems/1.8
gempath:
  • /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8


MacBook Pro   Mac OS X (10.5)  
Nicholas Cancel...

Posts: 49
From: Austin, TX
Registered: Jul 5, 2003
Re: Ruby on Rails FUBAR after gem update? Aptana and NetBeans no work now!!
Posted: Nov 8, 2007 11:28 AM   in response to: james2m
 

Does that work with Mac OS X apps too? I've found that things you put in your .profile or other shell/unix type stuff only work from the shell. I was able to get NetBeans and Aptana to work once I updated the plist for ~/.MacOS/environment.plist

MacBook Pro (intel)   Mac OS X (10.5)   iPhone, AirPort Extreme