在 MacOS Sierra 上安装 Rmagick 和 Imagemagick 时出错
Error installing Rmagick and Imagemagick on MacOS Sierra
我在 mac 上安装 Imagemagick@6 时遇到此错误。这让我无法使用 运行 我本地 machine 上的 rails 应用程序。我尝试了很多选项,例如更改 bash 配置文件、向配置添加内容等。我尝试删除 gem 和 rmv 文件并再次重新安装。
这是我每次都得到的。
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
首先更新brew
brew update
然后安装imagemagic brew install imagemagick@6
然后配置路径并安装rmagic gem
PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick
我在 mac 上安装 Imagemagick@6 时遇到此错误。这让我无法使用 运行 我本地 machine 上的 rails 应用程序。我尝试了很多选项,例如更改 bash 配置文件、向配置添加内容等。我尝试删除 gem 和 rmv 文件并再次重新安装。
这是我每次都得到的。
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
首先更新brew
brew update
然后安装imagemagic brew install imagemagick@6
然后配置路径并安装rmagic gem
PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick