Rails使用paperclip报CommandNotFoundError错的解决

已安装ImageMagick,但在设定了指定大小后paperclip报错:

Paperclip::Errors::CommandNotFoundError (Could not run the `identify` command. Please install ImageMagick.):
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/z2/n3vz292s0z7f995w0_bphm780000gn/T/1ce67fe3a364b6e5918d8fa96478ceef20170222-20952-1cruqw2.png[0]' 2>/dev/null

提示要你安装ImageMagick,但是前面说过已经装过了!!!

使用如下命令查看ImageMagick的信息:

brew info ImageMagick@6
ImageMagick@6: stable 6.9.7-9 (bottled) [keg-only]
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/ImageMagick@6/6.9.7-9 (1,465 files, 22.2M)
  Poured from bottle on 2017-02-22 at 18:05:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick@6.rb
==> Dependencies
Build: pkg-config ✔
Required: libtool ✔, xz ✔
Recommended: jpeg ✔, libpng ✔, libtiff ✔, freetype ✔
Optional: fontconfig ✘, little-cms ✘, little-cms2 ✘, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘, openjpeg ✘, fftw ✘, pango ✘
==> Requirements
Optional: perl >= 5.5 ✔
==> Options
--with-fftw
    Compile with FFTW support
--with-fontconfig
    Build with fontconfig support
--with-ghostscript
    Build with ghostscript support
--with-hdri
    Compile with HDRI support
--with-liblqr
    Build with liblqr support
--with-librsvg
    Build with librsvg support
--with-libwmf
    Build with libwmf support
--with-little-cms
    Build with little-cms support
--with-little-cms2
    Build with little-cms2 support
--with-opencl
    Compile with OpenCL support
--with-openexr
    Build with openexr support
--with-openjpeg
    Build with openjpeg support
--with-openmp
    Compile with OpenMP support
--with-pango
    Build with pango support
--with-perl
    Compile with PerlMagick
--with-quantum-depth-16
    Compile with a quantum depth of 16 bit
--with-quantum-depth-32
    Compile with a quantum depth of 32 bit
--with-quantum-depth-8
    Compile with a quantum depth of 8 bit
--with-webp
    Build with webp support
--with-zero-configuration
    Disables depending on XML configuration files
--without-freetype
    Build without freetype support
--without-jpeg
    Build without jpeg support
--without-libpng
    Build without libpng support
--without-libtiff
    Build without libtiff support
--without-magick-plus-plus
    disable build/install of Magick++
--without-modules
    Disable support for dynamically loadable modules
--without-threads
    Disable threads support
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Older version of imagemagick

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/ImageMagick@6/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/ImageMagick@6/lib
    CPPFLAGS: -I/usr/local/opt/ImageMagick@6/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/ImageMagick@6/lib/pkgconfig

进入/usr/local/opt/ImageMagick@6/bin查看,命令都在,应该是没有加入到path中去:

echo 'export PATH="/usr/local/opt/ImageMagick@6/bin:$PATH"' >> ~/.bash_profile

现在ok了!

你可能感兴趣的:(Ruby,Rails)