Skip to content

Instantly share code, notes, and snippets.

@danhorst
Last active December 18, 2015 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danhorst/5700846 to your computer and use it in GitHub Desktop.
Save danhorst/5700846 to your computer and use it in GitHub Desktop.
How to install the clamav gem on Mac OS X with boxen & homebrew installed clamav. Inspired by: https://gist.github.com/anarchivist/1724852
# /opt/boxen/repo/modules/projects/manifests/your_project.pp
# Install with: boxen your_project
#
# When you're using boxen DO NOT install clamav directly with: brew install clamav
# It won't link the header files correctly.
include homebrew
class projects::your_project {
notify { 'Setting up Your Project': }
package {
[
'clamav',
]:
}
}
$ gem install clamav
Fetching: clamav-0.4.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing clamav:
ERROR: Failed to build gem native extension.
/opt/boxen/rbenv/versions/1.9.3-p392/bin/ruby 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=/opt/boxen/rbenv/versions/1.9.3-p392/bin/ruby
--with-clamav-dir
--without-clamav-dir
--with-clamav-include
--without-clamav-include=${clamav-dir}/include
--with-clamav-lib
--without-clamav-lib=${clamav-dir}/lib
Gem files will remain installed in /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/clamav-0.4.1 for inspection.
Results logged to /opt/boxen/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/clamav-0.4.1/ext/clamav/gem_make.out
$ gem install clamav -- --with-clamav-include=/opt/boxen/homebrew/include/ --with-clamav-lib=/opt/boxen/homebrew/lib
Building native extensions. This could take a while...
Successfully installed clamav-0.4.1
1 gem installed
~/git/curate_nd master $ irb
irb(main):001:0> require 'clamav'
=> true
irb(main):002:0> a = ClamAV.instance
=> #<ClamAV:0x007ff3ab1e89c0>
irb(main):003:0> a.loaddb
LibClamAV Error: cli_loaddb(): No supported database files found in /opt/boxen/homebrew/Cellar/clamav/0.97.8/share/clamav
RuntimeError: cl_load() error: Can't open file or directory
from (irb):3:in `loaddb'
from (irb):3
from /opt/boxen/rbenv/versions/1.9.3/bin/irb:12:in `<main>'
irb(main):004:0> a.scanfile('/tmp/eicar.com')
=> 8
irb(main):005:0> a.scanfile('/tmp/1')
=> 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment