I try to execute ImageMagick on MacOS in an Ant script. Although there's no problem while running in the Terminal, Ant throws an error...

 [exec] dyld: Library not loaded: /ImageMagick-7.0.7/lib/libMagickCore-7.Q16HDRI.5.dylib
 [exec]   Referenced from: /Applications/ImageMagick/bin/mogrify
 [exec]   Reason: image not found
 [exec] Result: 134

When executing ImageMagick in the Terminal it runs without problems, when starting it in a subshell, the same error shows up. I guess, the environment variables are not passed correctly to the subshell...

My .bash_profile is...

 export PS1="\u@\h\w $ "
 export MAGICK_HOME="/Applications/ImageMagick"
 export PATH="$MAGICK_HOME/bin:$PATH"

Any ideas?



  • 1
    You are saying that Ant throws an error regardless of whether it's running in a subshell or not. This is confusing. Also, you are not showing what commands are used, just error output. – Kusalananda Jul 2 '18 at 11:53
  • The command in Ant is <exec executable="mogrify"> <arg value="mogrify -layers merge -format bmp *.psd" /> </exec> – Llaird Jul 2 '18 at 11:55
  • When running "mogrify -layers merge -format bmp *.psd" in bash it works perfectly, while the same command in a subshell of bash also shows the "Library not loaded" not loaded error – Llaird Jul 2 '18 at 12:02
  • probably stackoverflow.com/questions/20883212/… unless mogrify knows how to do something with the glob * – thrig Jul 2 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.