Search code examples
ruby-on-rails-3rvmcapistranobundlerrvm-capistrano

How to uninstall a gem from a production deployment with capistrano


I am deploying a rails app to production so gems go in shared/bundle. The mysql2 gem seems to have an issue in Ubuntu12.04 so I'd like to remove it and reinstall but how would I do this? I can't just call gem uninstall mysql2. I tried bundle exec gem uninstall mysql2 --path shared/bundle but got the error Could not locate Gemfile. How would I remove this? If you need any more info, lmk.

thx in advance


Solution

  • You have to be in the directory containing the Gemfile (such as your deployed project's current directory) in order for bundle exec to work. Try cd /path/to/your/project/current first, then bundle exec gem uninstall mysql2.

    If that still does not work, you can always just remove the gem manually. Just go to your bundle directory and rm -rf all the files/subdirectories related to that gem.