Why does bash sometimes think my $HOME isn't the correct directory?

Posted by Adam Yanalunas on Super User See other posts from Super User or by Adam Yanalunas
Published on 2012-03-19T01:35:13Z Indexed on 2012/03/19 2:07 UTC
Read the original article Hit count: 581

Filed under:
|
|

Like the title says it seems that bash sometimes misidentifies my $HOME. This cropped up after a seemingly unique series of events that I will now replay in broad strokes.

  • Running OS X 10.6 with normal, local account
  • Work binds my account to Active Directory
  • Much time passes with no issues
  • Set up rvm to manage Ruby installs (this becomes important later)
  • Upgraded to OS X 10.7 a few days ago
  • After successful install, attempted to log in, was presented with "Must reset password" dialog that never allowed a password to be reset. Would simply shake the box after new password was entered.
  • Much googling was done.
  • Much more googling was done.
  • Swearing was had.
  • Logged in as root, created new account, set as admin, deleted /Users/[new account], renamed /Users/[old account] to /Users/[new account]
  • Logged out of root, logged into new account with no issues

After OS X asking for a my account password a few times to update Keychain and other system-level stuff it was back to business as usual.

Opened Terminal, cd to project folder, tried "rails server" and was presented with:

/usr/local/lib/ruby/1.9.1/rubygems/dependency.rb:247:in to_specs': Could not find rails (>= 0) amongst [] (Gem::LoadError) from /usr/local/lib/ruby/1.9.1/rubygems/dependency.rb:256:into_spec' from /usr/local/lib/ruby/1.9.1/rubygems.rb:1210:in gem' from /usr/local/bin/rails:18:in'

Ran through a few exercises, decided to rm -rf ~/.rvm and reinstall. Running a --trace on the rvm installer shows it dies on this line:

mkdir: /Users/[old account]: Permission denied

Scrolling back through the --trace log I see many more mentions of /Users/[old account]. When inspect the install script the offending line is looking at "${HOME}/.rvm" as it tries to run the mkdir. To my confusion I also see mentions of /Users/[new account] in the log.

I've tried exporting a new HOME in my .bash_profile to no luck.

Can anyone guess why /Users/[old account] would still be kicking around?

© Super User or respective owner

Related posts about osx

Related posts about ruby-on-rails