I removed a gem 'mygem' from the Gemfile, but just now I realized it's still installed.
So how do I tell bundler to rescan the Gemfile and update Gemfile.lock, without updating every gem?
Coming from php, this is how I'm used to do this: composer update nothing
. Is there an equivalent for bundler?
The Gem Development guide says that the Gemfile. lock file "should always be checked into version control." However, this is NOT true for Gems. For Applications, like your Rails apps, Sinatra apps, etc., it is true. The same does not go for Gems.
Your gemfile is a list of all gems that you want to include in the project. It is used with bundler (also a gem) to install, update, remove and otherwise manage your used gems. These gems belong to development environment and the test environment since they are for testing the application.
run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.
You can run just bundle
or bundle install
to install gems based on your Gemfile. That will remove the instance of mygem
from your Gemfile.lock file. It will not, however, remove the gem from your system. To do that, run gem uninstall mygem
.
Not completely related, but still helpful:
bundle outdated
will show you the gems that aren't on the latest version. Don't get too tied up with this list - it's fairly common to have gems that aren't on the latest version, because some gems are installed as dependencies & one gem might be requiring an older version of another gem.bundle upgrade mygem
will upgrade just that gem, and will bring its dependencies up to date. That means that other gems might be upgraded or installed as well.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With