How can I fix an accidental 'sudo bundle install dir_name'?
After a bit of Googling around i was able to find the answer Just run:
sudo bundle install --system
and you'll have your gems back at their appropriate system directories.
pay attention on this...
from the bundle man page:
By default, bundler installs gems to the same location as gem install.
You should never use sudo bundle install. This is because several other steps in bundle install must be performed as the current user:
- Updating your Gemfile.lock
- Updating your vendor/cache, if necessary
- Checking out private git repositories using your user's SSH keys
Of these three, the first two could theoretically be performed by chowning the resulting files to $SUDO_USER. The third, however, can only be performed by actually invoking the git command as the current user. Therefore, git gems are downloaded and installed into ~/.bundle rather than $GEM_HOME or $BUNDLE_PATH.
As a result, you should run bundle install as the current user, and bundler will ask for your password if it is needed to put the gems into their final location.
The path is specified in a file located in
.bundle/config
If you delete the .bundle directory and then delete your smtp_mail directory you will be back at square one. If you really want a local (to your app) installation of the gems, I recommend you run
bundle install --path vendor/bundle
Good luck!