I am having trouble linking QGIS to GDAL since a few versions (just updated to 3.28 hopping it would solve the problem but it didn't). For instance, a Wrap function returns this error:

GDAL command output:
/Applications/QGIS-LTR.app/Contents/MacOS/bin/gdalwarp: line 2: dirname: command not found
/Applications/QGIS-LTR.app/Contents/MacOS/bin/gdalwarp: line 3: //run_gdal_binary.bash: No such file or directory
Process returned error code 127

The funny thing is that /Applications/QGIS-LTR.app/Contents/MacOS/bin/gdalwarp exists, and I can call it from the terminal from outside QGIS.

Can anyone see the reason why or has experienced the same problem?

  • Are you launching it from OSGEO4 shell? You can verify the install with OSGEO4 "setup".
    – Cary H
    Jul 25, 2023 at 18:18
  • Sorry - launch what? QGIS?
    – e5k
    Jul 26, 2023 at 6:42
  • Are you running GDAL from a command line? If you are, are you running it inside the OSGeo Shell? If not, how are you trying to use it?
    – Cary H
    Jul 26, 2023 at 12:02
  • No, just running GDAL from the MacOS terminal. Since GDAL doesn't work from within QGIS, I often end up copying the command displayed in the GUI to the terminal. Thanks for your help!
    – e5k
    Jul 26, 2023 at 12:28
  • Can you put an actual directory name in place of "command" to get it to a dataset? Does gdalinfo --version return the correct version? Example: gdalwarp -t_srs EPSG:3857 your_image_01.tif
    – Cary H
    Jul 26, 2023 at 15:42

2 Answers 2


Update - a solution from my co-worker. Under Preferences -> System -> Environment, I unticked the custom variables box entirely. Works now for me!

  • Well I wish I could buy your colleague a coffee! Thanks for sharing
    – e5k
    Jul 27, 2023 at 6:56
  • I've already told her I owe her a jar of my haskap jam, haha! Jul 27, 2023 at 12:43

I am having the same issue and message trying to use the Clip Raster by Mask Layer feature within Q. This is my first time trying to clip a georeferenced image and I'm not super experienced in using command lines, so I'm not certain if I have anything else set wrong. I tried going into settings and updating the Environment to the custom path "/Library/Frameworks/GDAL.framework/Programs:/Library/Frameworks/Python.framework/Versions/3.6/bin:" but it hasn't made a difference.

  • Welcome to GIS SE. As a new user, please take the Tour, which explains how our Focused question/Best answer model operates. We are not a discussion list. You have posted a "I'm having this problem too" comment in an Answer block, so this is likely to be removed on review (see the Why and how are some answers deleted? Help Center page).
    – Vince
    Jul 26, 2023 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.