MacOS – dyld: Library not loaded: on OSX

macosruby

I just got a new MacBook Pro, installed Catalina, and used the Migration Assistant to transfer my files over to the new machine. I changed the computer name and home folder for my account from oldname to newname.

I have a rails project that I was working on, and rails s is what I use to start the dev server. But on this new machine, I get this:

dyld: Library not loaded: /Users/oldname/.rvm/rubies/ruby-2.5.0/lib/libruby.2.5.dylib
Referenced from: /Users/newname/.rvm/rubies/ruby-2.5.0/bin/ruby
Reason: image not found
Abort trap: 6

How would I fix this? The binary exists in the newname directory, but the oldname directory is gone.

Best Answer

If you're afraid of rebuilding all of the project, and there's no support available for such cases, make a bare bone clone of the required folders in /Users/oldname which contains all the files required by the project.

Warning: This requires root password, and by default, /Users/ only contains:

  • All user accounts
  • Shared
  • Guest if enabled.

So I am not aware of the ramifications of the same.