Search code examples
ruby-on-railsbashrubygemsimagemagickrmagick

Error installing Rmagick and Imagemagick on MacOS Sierra


I get this error when installing Imagemagick@6 on my mac. This is stopping me from running the rails app on my local machine. I tried a bunch of options like changing the bash profile, adding things to config etc. I tried removing the gem and the rmv file and reinstalling again.

Here is what I get every time.

Building native extensions with: '--with-opt-lib /usr/local/opt/imagemagick@6/lib --with-opt-include /usr/local/opt/imagemagick@6/include'
    This could take a while...
    ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-opt-lib /usr/local/opt/imagemagick@6/lib --with-opt-include /usr/local/opt/imagemagick@6/include
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1674:in `dir_config': undefined method `split' for true:TrueClass (NoMethodError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2378:in `init_mkmf'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2415:in `<module:MakeMakefile>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:47:in `<top (required)>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from extconf.rb:4:in `<main>'


    Gem files will remain installed in /Users/neves/.rvm/gems/ruby-2.3.1@aut-rails4/gems/rmagick-2.16.0 for inspection.
    Results logged to /Users/neves/.rvm/gems/ruby-2.3.1@authorea-rails4/gems/rmagick-2.16.0/ext/RMagick/gem_make.out

Solution

  • Update brew at first brew update

    Then install imagemagic brew install imagemagick@6 Then config path and install rmagic gem

    PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick