What does rm -rf $HOME/.rvm* mean?

I ran it on my VPS server in Ubuntu Terminal by accident and now I'm having all sorts of problems with my ruby application. How can I undo it? Or what do I need to do to get back to the way things were, before I did it?

  • 1
    See man rm for info on what it did. * is a wildcard that matches any character any number of times, so .rvm* means all files/folders whose name begins with .rvm. What you should do? Reinstall your Ruby application (or restore from a recent backup). – Daniel Andersson Jul 22 '13 at 20:00
  • 1
    You deleted all the rvm configuration files/directory for the user you were logged in as. Restore from backup, or re-install would be the common solutions. – ernie Jul 22 '13 at 20:01
  • @ernie -Not sure what you mean by 'restore from back up'? Could you tell me how to do that? I did get on to my VPS hosting company and they could restore it only to the 18th July, if that's what you mean. I did the mistake on the 17th - only realised the cause of it today, when I discovered the .bash_history file. – CHarris Jul 22 '13 at 21:10
  • @Daniel Andersson - cheers, I'll look into that. When you say 'reinstall your ruby application', do you mean reinstall rvm? – CHarris Jul 22 '13 at 21:14
  • @ChristopheHarris if you weren't keeping backups, then there won't be any. Consider this a lesson learned. You'll likely have to reinstall RVM, and then re-apply any custom settings/configurations you had. – ernie Jul 22 '13 at 21:42

Restore the deleted files from your fine backups that you should be keeping.

  • where would I find the 'fine back ups'? My hosting company said they keep records only as far as the previous week, which is too late for me. – CHarris Jul 22 '13 at 21:12
  • Lessons are best learned the hard way. Firstly, don't run commands if you don't know what they do..seriously wtf? And second, have a backup strategy. – Scandalist Jul 28 '13 at 1:30

It is good practice to keep your application configuration in the project so assuming you have such files you should be able to rebuild environment from it:

  1. install rvm again: \curl -L https://get.rvm.io | bash -s stable
  2. load rvm into shell: source ~/.rvm/scripts/rvm
  3. find the project directory, and cd to it: cd ~/apps/my_app
  4. try to install and use ruby from the project: rvm use --install --create .
  5. try to install gems from the project: bundle install

For the 4th step there should be most likely file called .rvmrc or .ruby-version but rvm can even try to detect ruby from Gemfile

For the 5th step most ruby applications use Gemfile to manage your gem dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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