14

Assume you installed Imagemagick by

brew install imagemagick

but it does not get into your PATH. For example, I run unsuccessfully

compare

since imagemagick is not in PATH: -bash: compare: command not found.

The command ls -l /usr/local/bin/compare gives

ls: /usr/local/bin/compare: No such file or directory

My .bash_profile

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

# http://apple.stackexchange.com/a/53058/15504
export PATH=/usr/bin:/usr/local/bin:/opt/local/sbin:$PATH

Echoing $PATH gives

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin

which seems to be ok because /usr/local/bin/ there.

ImageMagick in my system - answers to 4ae1e1's answer

The command brew --prefix gives /usr/local so ok.

The command brew info imagemagick gives

imagemagick: stable 6.9.0-3 (bottled), HEAD
http://www.imagemagick.org
/usr/local/Cellar/imagemagick/6.9.0-3 (1440 files, 22M)
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/imagemagick.rb
==> Dependencies
Build: xz ✔, pkg-config ✔
Required: libtool ✔, xz ✔
Recommended: jpeg ✔, libpng ✔, freetype ✔
Optional: fontconfig ✔, libtiff ✔, little-cms ✘, little-cms2 ✘, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘, fftw ✘
==> Options
--enable-hdri
        Compile with HDRI support
--with-fftw
        Compile with FFTW support
--with-fontconfig
        Build with fontconfig support
--with-ghostscript
        Build with ghostscript support
--with-jp2
        Compile with Jpeg2000 support
--with-liblqr
        Build with liblqr support
--with-librsvg
        Build with librsvg support
--with-libtiff
        Build with libtiff support
--with-libwmf
        Build with libwmf support
--with-little-cms
        Build with little-cms support
--with-little-cms2
        Build with little-cms2 support
--with-openexr
        Build with openexr support
--with-perl
        enable build/install of 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-x11
        Build with x11 support
--without-freetype
        Build without freetype support
--without-jpeg
        Build without jpeg support
--without-libpng
        Build without libpng support
--without-magick-plus-plus
        disable build/install of Magick++
--HEAD
        Install HEAD version

which seems to be ok.

I run the command brew link imagemagick and get

Linking /usr/local/Cellar/imagemagick/6.9.0-3... 
Error: Could not symlink bin/convert
Target /usr/local/bin/convert
already exists. You may want to remove it:
  rm '/usr/local/bin/convert'

To force the link and overwrite all conflicting files:
  brew link --overwrite imagemagick

To list all files that would be deleted:
  brew link --overwrite --dry-run imagemagick

This seems to be strange. How can you solve this problem?

I run the command brew reinstall imagemagick and get

==> Reinstalling imagemagick
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/imagemagick
Already downloaded: /Library/Caches/Homebrew/imagemagick-6.9.0-3.yosemite.bottle.tar.gz
==> Pouring imagemagick-6.9.0-3.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/convert
Target /usr/local/bin/convert
already exists. You may want to remove it:
  rm '/usr/local/bin/convert'

To force the link and overwrite all conflicting files:
  brew link --overwrite imagemagick

To list all files that would be deleted:
  brew link --overwrite --dry-run imagemagick

Possible conflicting files are:
/usr/local/bin/convert
/usr/local/share/man/man1/convert.1
==> Summary
🍺  /usr/local/Cellar/imagemagick/6.9.0-3: 1440 files, 22M

so something wrong in symlinking.

How can you solve the error about symlink?

  • What have you tried? Where did you get stuck? Do you know how to use the command line? Have you read the ImageMagick manual pages? You haven't given us much in the question to work with, so it's hard to know how to help you. We expect you to make a serious effort on your own before asking here, and to show us in the question what you've tried and what happened. – D.W. Mar 20 '15 at 23:23
  • Basically you just run it from Terminal with the options you want. From your question it's unclear whether running from Terminal fails, whether you don't know how to use it to accomplish a specific task or whether you have a different problem. So please clarify by editing your question, it will then automatically placed into the reopen queue. – nohillside Mar 21 '15 at 7:13
  • 1
    Please try type -a compare and ls -l /usr/local/bin/compare as patrix suggested. – 4ae1e1 Mar 21 '15 at 14:48
  • 1
    I'll give you a list of things to try shortly. – 4ae1e1 Mar 21 '15 at 16:05
  • 1
    maybe it's a bit useless now, but this simple solution worked for me: stackoverflow.com/questions/13998161/… – jjrr Mar 13 '17 at 10:03
12

A list of things to try, in order (I'm writing an answer instead of a comment for better formatting). Run hash -r after each step (assuming you're in bash; do rehash instead for zsh; or you can always open a new shell).

  1. Run brew --prefix and see if the output is /usr/local. If not, your brew is not installed to /usr/local! Add $(brew --prefix)/bin to you $PATH.

  2. Run brew info imagemagick and make sure it's actually installed; maybe you had an error during installation and it was simply not installed successfully.

  3. Run brew link imagemagick to symlink to /usr/local/bin; maybe the executables weren't symlinked correctly (for some reason);

  4. Run brew reinstall imagemagick to reinstall.

  5. If it still doesn't work, show us the output of brew list imagemagick and we'll see what's wrong.

  • You are right! There is some error in symlinking. See my update. – Léo Léopold Hertz 준영 Mar 21 '15 at 16:32
  • I did rm '/usr/local/bin/convert' and rm '/usr/local/share/man/man1/convert.1'? – Léo Léopold Hertz 준영 Mar 21 '15 at 16:35
  • @Masi That's not the best thing to do. convert is an ImageMagick command, so I'd say it's safe to just do brew link --overwrite imagemagick. If you want to be overly cautious, you can do brew link --overwrite --dry-run imagemagick to have a look at the list of overwritten files first, but I'd say that's not necessary. – 4ae1e1 Mar 21 '15 at 16:36
  • By the way, maybe you installed some non-Homebrew software that provided a convert binary in /usr/local/bin? Could you run convert --version to make sure it's actually the ImageMagick convert? – 4ae1e1 Mar 21 '15 at 16:37
  • 1
    @Masi hash -r rehashes the list of commands known to the shell. It helps with autocomplete and stuff, so why not. reset has little to do with your shell environment, it just resets the terminal and helps with nothing but printing issues. – 4ae1e1 Mar 21 '15 at 16:45
0

jjrr's proposal in the comments where you need to follow the instructions too

brew doctor

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .