Problems after updating to rails 2.1

Hi everybody,

I just updated to rails 2.1 as root user, and noticed that non root
users have different rails versions than root. I thought updating as
root would make 2.1 available for all users. I was hoping this because
some permissions problems prevent my normal user from updating rails to
2.1. Look at the following gem lists. (I’m on a mac)

sline:~/eclipseWorkspace: gem list rails

*** LOCAL GEMS ***

rails (2.0.2, 1.2.3, 1.1.6)
sline:~/eclipseWorkspace: su -
Password:
SlineMac:~ root# gem list rails

*** LOCAL GEMS ***

rails (2.1.0, 1.2.6, 1.2.3)
SlineMac:~ root#

First, why are they different?

Second, If I try to upgrade to 2.1 as the non root user I get a
permissions problem:

sline:~/eclipseWorkspace: gem install -v=2.1.0 rails
— snip gem updating messages —
ERROR: While executing gem … (Errno::EACCES)
Permission denied -
/usr/local/lib/ruby/gems/1.8/cache/activesupport-2.1.0.gem

Third if I try to create a new app now as non root user, I get a gem
require error:

sline:~/eclipseWorkspace: rails fmpden
/usr/local/bin/rails:17: undefined method `require_gem’ for main:Object
(NoMethodError)

I can create a new application as root, but jeepers, I don’t want to do
my work as root, and while changing the perms on the new app so the non
root user could use it would work, it is really a symptom of something
being wrong.

Thank you for any help,
Steve

Looks like ruby is installed “locally” for the “user”…

which ruby

and

ruby -v

for both root and the user. or maybe the environment is different
somehow?

env

for both users

heimdull wrote:

Looks like ruby is installed “locally” for the “user”…

which ruby

and

ruby -v

for both root and the user. or maybe the environment is different
somehow?

env

for both users

Wow, you’re right, here’s the output. Seems like my paths are not in
the same order with respect to /usr/local/bin and /usr/bin. I can fix
that. I wonder if that will fix everything else . . . We’ll see.

sline:~/eclipseWorkspace: which ruby
/usr/local/bin/ruby

sline:~/eclipseWorkspace: ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-darwin8.11.1]

sline:~/eclipseWorkspace: su -
Password:
SlineMac:~ root# which ruby
/usr/bin/ruby

SlineMac:~ root# ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]

SlineMac:~ root# ls -ld /usr/bin/ruby
lrwxr-xr-x 1 root wheel 76 Jul 22 08:26 /usr/bin/ruby ->
…/…/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

SlineMac:~ root# ls -ld /usr/local/bin/ruby
-rwxr-xr-x 1 root wheel 1824244 Apr 26 09:53 /usr/local/bin/ruby

I know this is weird, but after upgrading to leopard (or some other
undetermined event), it appears the su - command doesn’t execute the
root .bash_profile anymore. So my .bash_profile wasn’t getting executed
and my paths are in different orders due to a default path being used
for root.

Finally found the root of the problem: my root login shell was changed
to sh from bash. It used to be bash. I bet upgrading to leopard did
this little favor for me. How sweet!

Steven L. wrote:

I know this is weird, but after upgrading to leopard (or some other
undetermined event), it appears the su - command doesn’t execute the
root .bash_profile anymore. So my .bash_profile wasn’t getting executed
and my paths are in different orders due to a default path being used
for root.

So it’s probably fixed now. I su’d to root, manually ran my
.bash_profile so root is now using the same path and same ruby as non
root users, and I gem updated rails. Now the non root users use the
same 2.1 rails as root.

Thank you heimdull for your keen eye and superior intelligence!

Steve