There is an issue with running xquartz on my system. I installed it by using the link from the Apple website. However when I run xquartz from terminal I get:

:~$ xquartz
/Applications/Utilities/XQuartz.app/Contents/MacOS/X11: line 10: /usr/local/bin/bash: No such file or directory
/Applications/Utilities/XQuartz.app/Contents/MacOS/X11: line 10: exec: /usr/local/bin/bash: cannot execute: No such file or directory

This is preventing me from launching xquartz/x11 applications that I downloaded through macports. How can I resolve this so that xquartz runs properly?

  • Is /usr/local/bin/bash an executable/binary or a symlink to one? – nohillside Dec 19 '13 at 11:02
  • 1
    I did not have any reference to bash in the folder. I created a symlink for it and it resolved my errors. – Raymond Valdes Dec 19 '13 at 17:14

/Applications/Utilities/XQuartz.app/Contents/MacOS/X11 is just a shell script that executes whatever is defined as $SHELL in your environment:

case $(basename "${SHELL}") in
    bash)          exec -l "${SHELL}" --login -c 'exec "${@}"' - "${@}" ;;


In your case, it look as though $SHELL is set to /usr/local/bin/bash, which doesn't exist. What's interesting, though, is that since you have a prompt at which you have typed xquartz, you clearly are running a shell of some description. However, it doesn't correspond to the value of $SHELL.

Two suggestions for how this might happen:

  1. $SHELL will normally reflect the login shell for your user. You can set that in System Preferences -> Users & Groups -> right click on your username and choose "Advanced Options". If you set this to an invalid value, you won't normally be able to open a terminal... unless you go into the Terminal.app preferences and set the "Shells open with:" option to something which does exist. You'll then get a working terminal with a non-existent $SHELL.
  2. Alternatively, it might be something in your shell startup scripts (.bashrc, .profile, etc) which export a misleading value of $SHELL to the environment. If you have customized any of these, take a look and make sure you're not setting things up incorrectly.
  • Thank you for your help; it helped me understand the problem and implement a fix. You're right, I had a shell open already and used which bash to give me the correct path. I then created a symlink to that bash and put it in /usr/local/bin/bash. I am now able to use xquartz, tested with xclock, gimp, etc. – Raymond Valdes Dec 19 '13 at 17:19

You must log in to answer this question.

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