Betty St
Betty St

Reputation: 2870

Installing optipng with homebrew: command not found (rbenv?)

I've successfully installed optipng:

  $ brew install optipng
  ==> Downloading https://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.5/optipng-0.7.5.tar.gz
  Already downloaded: /Library/Caches/Homebrew/optipng-0.7.5.tar.gz
  ==> Patching
  patching file src/optipng/osys.c
  ==> ./configure --with-system-zlib --prefix=/usr/local/Cellar/optipng/0.7.5 --mandir=/usr/local/Cellar/optipng/0.7.5/share/man
  ==> make install
  🍺  /usr/local/Cellar/optipng/0.7.5: 6 files, 156K, built in 2 seconds

but when I use the command it says the following:

$ optipng
rbenv: optipng: command not found

The `optipng' command exists in these Ruby versions:
  jruby-1.7.10
  jruby-1.7.11
  jruby-1.7.9

If I use this path /usr/local/Cellar/optipng/0.7.5/bin/optipng it works!!

Has this something to do with rbenv? Or why isn't the optipng command global?

$ rbenv global
1.9.3-p429

I've also tried brew unlink optipng and brew link optipng -> same error!

Upvotes: 2

Views: 1353

Answers (1)

Betty St
Betty St

Reputation: 2870

Ok i found out that I had the image_optim_bin gem in one of my projects installed, after uninstalling this gem for all ruby versions, the command finally works!

$ gem uninstall image_optim_bin
Remove executables:
  advdef, advmng, advpng, advzip, jpegoptim, jpegtran, optipng, pngcrush, pngout

in addition to the gem? [Yn]  
Removing advdef
Removing advmng
Removing advpng
Removing advzip
Removing jpegoptim
Removing jpegtran
Removing optipng
Removing pngcrush
Removing pngout
Successfully uninstalled image_optim_bin-0.0.4 

opened new terminal and now it works:

$ optipng
Synopsis:
    optipng [options] files ...
Files:
    Image files of type: PNG, BMP, GIF, PNM or TIFF
Basic options:
    -?, -h, -help show the extended help
    -o <level>    optimization level (0-7)    [default: 2]
    -v      run in verbose mode / show copyright and version info

Upvotes: 1

Related Questions