berkshelfを実行するとエラーが出る時の対策



```エラーメッセージ
$ berks -v
/Library/Ruby/Gems/2.0.0/gems/ffi-1.9.6/lib/ffi/library.rb:133:in `block in ffi_lib': Could not open library '/Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle': dlopen(/Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle, 5): Library not loaded: /private/var/folders/2h/rfd6zc9s4m95b6bkxk7mtyvr0000gn/T/bundler20141219-52027-11kavuj/dep-selector-libgecode-1.0.2/gems/dep-selector-libgecode-1.0.2/lib/dep-selector-libgecode/vendored-gecode/lib/libgecodesearch.32.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_gecode.bundle
  Reason: image not found
	from /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.6/lib/ffi/library.rb:100:in `map'
	from /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.6/lib/ffi/library.rb:100:in `ffi_lib'
	from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dep_gecode.rb:39:in `<module:Dep_gecode>'
	from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dep_gecode.rb:21:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/gecode_wrapper.rb:21:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/dependency_graph.rb:21:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector/selector.rb:21:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/dep_selector-1.0.3/lib/dep_selector.rb:22:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve/solver.rb:1:in `<top (required)>'
	from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:10:in `require_relative'
	from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:10:in `<module:Solve>'
	from /Library/Ruby/Gems/2.0.0/gems/solve-1.2.1/lib/solve.rb:3:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/lib/berkshelf.rb:8:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/lib/berkshelf/cli.rb:1:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:73:in `require'
	from /Library/Ruby/Gems/2.0.0/gems/berkshelf-3.1.5/bin/berks:3:in `<top (required)>'
	from /usr/bin/berks:23:in `load'
	from /usr/bin/berks:23:in `<main>'
```

# 対策：dep_selectorとdep_selector_libgecodeを入れなおす

```
$ sudo gem uninstall dep-selector-libgecode dep_selector
$ gem install dep-selector-libgecode -v 1.0.0
$ gem install dep-selector -v 1.0
```

# 参考URL

[Library not loaded. Reason: image not found · Issue #1234 · berkshelf/berkshelf · GitHub](https://github.com/berkshelf/berkshelf/issues/1234)

[OSX: With homebrew GeCode 4.x installed, gem doesn't work · Issue #22 · opscode/dep-selector · GitHub](https://github.com/opscode/dep-selector/issues/22)