Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Clam AV Error on Bundle install

Michael Tribone edited this page Apr 23, 2019 · 5 revisions

The ClamAV gem may fail to install due to missing libraries, resulting in an error message similar to:

Fetching clamav 0.4.1
Installing clamav 0.4.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/cam156/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/clamav-0.4.1/ext/clamav
/Users/cam156/.rbenv/versions/2.3.3/bin/ruby -r ./siteconf20180313-51478-u4j8nm.rb extconf.rb
checking for clamav.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/cam156/.rbenv/versions/2.3.3/bin/$(RUBY_BASE_NAME)
	--with-clamav-dir
	--without-clamav-dir
	--with-clamav-include
	--without-clamav-include=${clamav-dir}/include
	--with-clamav-lib
	--without-clamav-lib=${clamav-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/cam156/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-17/2.3.0-static/clamav-0.4.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/cam156/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/clamav-0.4.1 for inspection.
Results logged to /Users/cam156/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-17/2.3.0-static/clamav-0.4.1/gem_make.out

An error occurred while installing clamav (0.4.1), and Bundler cannot continue.
Make sure that `gem install clamav -v '0.4.1'` succeeds before bundling.

Currently, version 0.101.1 of clamav has some problems finding the necessary SSL headers from openssl. See https://github.com/eagleas/clamav/issues/11 for more info. If you have this version installed, you'll need to downgrade clamav via brew.

Check your clamav install:

ls /usr/local/Cellar/clamav 

If you see 0.101.1, unlink this version and install version 0.100.2

brew unlink clamav
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ee7114856bafbfac500a4d039d7d5bf26511158a/Formula/clamav.rb

If you get a zlib and/or zlib-devel error install:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

The clamav gem should install normally via bundler:

bundle install clamav

If you're still seeing an error, you may need to explicitly provide the path to the clamav directory. Using gem, install clamav with these parameters:

gem install clamav -- --with-clamav-dir=/usr/local/Cellar/clamav/0.100.2 
Clone this wiki locally