Vvv: Error installing mailcatcher

Created on 1 Sep 2016  路  9Comments  路  Source: Varying-Vagrant-Vagrants/VVV

When I run vagrant provision, I get an error in regard to Mailcatcher:

ERROR:  Error installing mailcatcher:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:2:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-1.0.9.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/eventmachine-1.0.9.1/ext/gem_make.out

The provision script continues, and works fine, but Mailcatcher obviously hasn't been installed.

I did a little searching on the error, and found https://github.com/sj26/mailcatcher/issues/144 and ultimately https://github.com/sj26/mailcatcher/issues/277. It seems that while Mailcatcher itself is compatible with Ruby 1.9.x, some of its dependencies aren't. The solution is to either install a lower version of those dependencies, or update Ruby.

I ran these commands to install mailcatcher:

sudo apt-get install ruby-dev
sudo gem install mime-types --version "< 3"
sudo gem install --conservative mailcatcher

Despite the last command issuing an error about the mime-types dependency version, running mailcatcher seems to work:

vagrant@vvv:~$ mailcatcher
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
*** MailCatcher runs as a daemon by default. Go to the web interface to quit.

However, Firefox can't connect to http://127.0.0.1:1080. I guess maybe I have to run provision again now or something?

reporter-feedback

Most helpful comment

So I am still facing this issue with the current version of VVV.

I got mailcatcher running manually by following the steps mentioned by @JDGrimes taken from https://github.com/sj26/mailcatcher/issues/277

sudo apt-get install ruby-dev
sudo gem install mime-types --version "< 3"
sudo gem install --conservative mailcatcher

To actually get it working (make it accessible outside the VM, instruct PHP to use it) you need to do more, namely fixing the paths for the service and PHP:

sudo sed -i 's/\/rvm//g' /etc/init/mailcatcher.conf
sudo sed -i 's/\/rvm//g' /etc/php/7.0/mods-available/mailcatcher.ini
sudo sed -i 's/\/rvm//g' /etc/php/5.6/mods-available/mailcatcher.ini

This will fix the path
/usr/local/rvm/bin/mailcatcher ->
/usr/local/bin/mailcatcher in those three config files above.

After that you need to restart (not reprovision) the VM or restart all relevant services as done in the provision script.

All 9 comments

However, Firefox can't connect to http://127.0.0.1:1080. I guess maybe I have to run provision again now or something?

Still cannot connect to http://127.0.0.1:1080 or http://vvv.dev:1080, even after running vagrant up --provision.

I didn't get the errors related to Mailcatcher, but I did get this:

==> default: sh: 1: 
==> default: /usr/local/rvm/bin/catchmail: not found

Is this related?

Runningwhich catchmail reveals /usr/local/bin/catchmail.

I don't know.
Have you tested provisioning a new VVV from scretch?

I was getting the same error and provisioning VVV from scratch solved it.

For posterity: I just updated to VVV 2.0 and destroyed my box and reprovisioned. Now Mailcatcher is working for me.

Thanks facing similar issue. Too bad to see that the only option is to destroy VVV and wait hours to resolve this issue.

So I am still facing this issue with the current version of VVV.

I got mailcatcher running manually by following the steps mentioned by @JDGrimes taken from https://github.com/sj26/mailcatcher/issues/277

sudo apt-get install ruby-dev
sudo gem install mime-types --version "< 3"
sudo gem install --conservative mailcatcher

To actually get it working (make it accessible outside the VM, instruct PHP to use it) you need to do more, namely fixing the paths for the service and PHP:

sudo sed -i 's/\/rvm//g' /etc/init/mailcatcher.conf
sudo sed -i 's/\/rvm//g' /etc/php/7.0/mods-available/mailcatcher.ini
sudo sed -i 's/\/rvm//g' /etc/php/5.6/mods-available/mailcatcher.ini

This will fix the path
/usr/local/rvm/bin/mailcatcher ->
/usr/local/bin/mailcatcher in those three config files above.

After that you need to restart (not reprovision) the VM or restart all relevant services as done in the provision script.

I ran into this issue too, and found that also needed to install the dev package of sqlite. Not a biggie - just thought I should mention it for completeness.

I just ran into this issue on VVV 2.0.0, @kraftner 's comments did work for me though (https://github.com/Varying-Vagrant-Vagrants/VVV/issues/985#issuecomment-314806759)

local ruby ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

box ruby after provision ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings