mailcatcher
mailcatcher copied to clipboard
Mac BigSur 11.11.2 installation error
Following error on new install
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/rbconfig.rb:229: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Fetching thin-1.5.1.gem
Fetching rack-1.6.13.gem
Fetching daemons-1.3.1.gem
Fetching eventmachine-1.0.9.1.gem
Fetching rack-protection-1.5.5.gem
Fetching skinny-0.2.4.gem
Fetching tilt-2.0.10.gem
Fetching sinatra-1.4.8.gem
Fetching mini_mime-1.0.3.gem
Fetching mail-2.7.1.gem
Fetching mailcatcher-0.7.1.gem
Successfully installed daemons-1.3.1
Building native extensions. This could take a while...
Successfully installed eventmachine-1.0.9.1
Successfully installed rack-1.6.13
Building native extensions. This could take a while...
ERROR: Error installing mailcatcher:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/thin-1.5.1/ext/thin_parser
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20210331-19927-63j625.rb extconf.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin20/rbconfig.rb:229: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
checking for main() in -lc... yes
creating Makefile
current directory: /Library/Ruby/Gems/2.6.0/gems/thin-1.5.1/ext/thin_parser
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.6.0/gems/thin-1.5.1/ext/thin_parser
make "DESTDIR="
compiling parser.c
parser.rl:142:7: error: implicit declaration of function 'thin_http_parser_has_error' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (thin_http_parser_has_error(parser) ) {
^
parser.rl:142:7: note: did you mean 'http_parser_has_error'?
./parser.h:44:5: note: 'http_parser_has_error' declared here
int http_parser_has_error(http_parser *parser);
^
parser.rl:144:14: error: implicit declaration of function 'thin_http_parser_is_finished' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
} else if (thin_http_parser_is_finished(parser) ) {
^
2 errors generated.
make: *** [parser.o] Error 1
make failed, exit code 2
I had same issue, and it worked when I tried this:
gem install mailcatcher -- --with-cflags="-Wno-error=implicit-function-declaration"
✅
This issue is purportedly fixed in Thin 1.8.0, so if the version constraint is adjusted maybe the issue would go away?
The workaround for now is:
gem install thin -v 1.5.1 -- --with-cflags="-Wno-error=implicit-function-declaration"
gem install mailcatcher
The long term fix will be moving away from thin.
Or just use a docker image https://hub.docker.com/r/stpaquet/alpinemailcatcher ;-) I found this approach being the most efficient as you do not have to worry about the version of Ruby installed on your system since you do not need Ruby on your environment to be installed.
I got a different error with openssl at first and then the above error. Finally was able to install on ruby 3.1.3, mac M1, with this. command:
gem install mailcatcher -- --with-openssl-dir=$(brew --prefix openssl) --with-cflags="-Wno-error=implicit-function-declaration"
I have pushed another pre-release, v0.9.0.beta2, which relaxes the thin requirement and avoid this compilation error. Please try it:
gem install mailcatcher --pre