Search code examples
ruby-on-railsruby-on-rails-4mailcatcher

can't activate thin (~> 1.5.0), already activated thin-1.7.0


I am using Mail Catcher in my Rails application and when i try to start the server or run rake db:migrate i am getting the following error.

/Users/harshamv/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.2/lib/bundler/rubygems_integration.rb:346:in `block (2 levels) in replace_gem': can't activate thin (~> 1.5.0), already activated thin-1.7.0. Make sure all dependencies are added to Gemfile. (Gem::LoadError)

Solution

  • I experienced similar issues, and I was not really enjoying the idea to have gems specific to Mailcatcher polluting my development environment. So I opted for another solution: using Mailcatcher in a docker container.

    As I was not very satisfied by the containers I found I created one based on Alpine to limit its footprint (~36MB). It's very straight forward to use and this protects you from this type of issues.

    More generally speaking using Containers for Rails (or other prog lang) is a good idea as it enables the creations of isolated environments and aligns your dev, test, staging and production environments.

    You can find my cut here with "how-to" on the same page.