If you are using gs for managing your gem sets and you are also using any tool that relies on Ghostscript for converting PDF files to other formats (e.g. GraphicsMagick, docsplit, etc.), you may find that one of the two will fail due to a conflict between the two gs
commands.
There are two possible solutions to this problem:
- rename the gs command to something else (e.g.
gset
,gs_
, etc), and leave Ghostscript'sgs
as the onlygs
command in your system. - edit GraphicMagick's delegates file and specify the full path to the
gs
command. This file is located in thelib/GraphicsMagick/config
directory of your GraphicsMagick's installation. If GraphicsMagick was installed via homebrew, you can find the full path to this file by runningbrew list graphicsmagick | grep delegates
. Each transformation supported bygm convert
will have a matching configuration line in this file. All delegations which have a command starting withcommand='"gm"
must be updated using the full path to the Ghostscript's executable file (e.g.command='"/usr/local/bin/gs"
).
I have not tested it yet, but ImageMagick uses the same delegates.mgk
file so the same solution may apply.
If due to the PATH order gs
executes Ghostscript, this trick would make gs
to always execute gs instead:
alias gs="`brew list ruby | grep bin/gs`"
Thanks for this tip! I edited our GraphicsMagick "delegates.mgk" file and replaced
@PSDelegate@
with the physical path to GhostScript. As a result, PDF-to-Image conversion is functioning properly and the path isn't required to be entered in the system path.