Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
What does dscl . -read /Users/$USER (≥10.5) or niutil -read . /users/$USER (≤10.4) say your home is? (Alternately, check Directory Utility.app (≥10.5) or NetInfo Manager.app (≤10.4).) –  ephemient Mar 19 '12 at 3:44
    
dscl reports home as NFSHomeDirectory: /Users/adam, which is what you would expect. –  Adam Yanalunas Mar 20 '12 at 20:23

2 Answers 2

up vote 2 down vote accepted

I ended up solving this problem, although it's not the most elegant solution.

As rvm wouldn't run at all an rvm implode wasn't an option. Instead I just ran rm -rf ~/.rvm and reinstalled rvm.

It may be unrelated but I also had to download the osx-gcc-installer and set export CC=/usr/bin/gcc-4.2 before rvm and ruby builds would behave correctly. Using the with-gcc=clang did not provide usable builds.

share|improve this answer

Something is clobbering your $HOME Variable.

Add this to your .bashrc file

 declare -x -r HOME=/correct/home/path
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.