You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

problem with terminal on Mac os: (Dquote cmdsubst)

Hi everyone,




Excuse me for the inconvenience ... and thank you in advance ,.




So here is my problem:




Lately I've been having fun with home brew on the Mac, and everything is fine until I run the brew doctor command,




He found a small problem and offered me a correction,




  Here is all the text he gave me:




(Please note that these warnings are just used to help the Homebrew maintainers








with debugging if you file an issue. If everything you use Homebrew for is








working fine: please don't worry or file an issue; just ignore this. Thanks!
















Warning: Homebrew's sbin was not found in your PATH but you have installed








formulae that put executables in /usr/local/sbin.








Consider setting the PATH for example like so:








  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc)








So naturally I did what he asked me to do, which was to run the following command line:




echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc








The concern is that the command did not solve the little problem with homebrew but even worse ... it created a new, more serious problem for me:




Now all the scripts I want to run give me the same result:




(Dquote cmdsubst>)




Example of the scripts I want to use, the official homebrew uninstall script:




/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh






And it gives me the same result, (dquote cmdsubst>), yet I tried in the past to run the same script before and it worked, meaning I managed to uninstall home brew,


but after brew doctor's manipulations the script no longer works,


To be honest… I'm not familiar enough with the terminal… so I absolutely don't understand what all of this means and I don't want to know it,


What I want is for the terminal to return to its usual behavior so that I can reuse scripts normally.


That's the whole problem, I apologize again for this long text,


Cordially.

MacBook Pro with Touch Bar

Posted on Jan 4, 2021 10:24 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 4, 2021 11:44 AM

Problems like this are almost impossible to debug remotely because there are a lot of nuances to it, and you kind of need to understand the underlying issues to be able to fix them effectively.


First off, consider Terminal.app as doing NOTHING except for running another program known as your shell. It's the shell, NOT terminal.app that takes your input/commands and processes it. All Terminal.app does is take what you type and pass it to the shell for processing.


Now, for various historical reasons, there are many possible shells you can use. You might have heard of some of them - sh, csh, bash, ash, zsh, to name a few. Which one to use is largely a matter of personal preference.


Apple used to define bash as the default shell for Mac OS X, but they changed to zsh in Catalina.


Here's the kicker - you need to know which one you're using in order to fix your problem.


For example, the instructions you followed to change your path:


  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc)


Explicitly writes the PATH command to your .zshrc file which is executed when zsh starts.


However, later in your post you state:


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh


so now you are explicitly running your curl command under BASH.


Guess what? BASH doesn't give two hoots what configuration options you use in ZSH. They are two completely different beasts. Therefore the first command (editing your $PATH) has no effect.


You need to decide if you want to use BASH moving forwards (change your Terminal.app preferences to use BASH rather than ZSH), or if you want to use ZSH (in which case execute your curl command in your zsh shell rather than invoking a new bash shell.


Confused yet? I did warn you.


No one can tell you the 'right' way to do this. TBH it's one of the bigger problems with homebrew (et. al.). While they do offer a peek into the world of UNIX executables, you are somewhat at the mercy of the homebrew guys and how they think/prefer things to be done. If you don't follow their model 100% (e.g. bash vs. zsh), that's OK, but you need to know enough of the gears/knobs/buttons to be able to tweak it for your environment.


That said, zsh has been the default Mac OS shell for a while now, so I'm surprised anyone is giving you BASH-specific advice, unless you're following an out of date support article, or that homebrew is still assuming bash.

Similar questions

3 replies
Question marked as Top-ranking reply

Jan 4, 2021 11:44 AM in response to Platinum-Akari

Problems like this are almost impossible to debug remotely because there are a lot of nuances to it, and you kind of need to understand the underlying issues to be able to fix them effectively.


First off, consider Terminal.app as doing NOTHING except for running another program known as your shell. It's the shell, NOT terminal.app that takes your input/commands and processes it. All Terminal.app does is take what you type and pass it to the shell for processing.


Now, for various historical reasons, there are many possible shells you can use. You might have heard of some of them - sh, csh, bash, ash, zsh, to name a few. Which one to use is largely a matter of personal preference.


Apple used to define bash as the default shell for Mac OS X, but they changed to zsh in Catalina.


Here's the kicker - you need to know which one you're using in order to fix your problem.


For example, the instructions you followed to change your path:


  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc)


Explicitly writes the PATH command to your .zshrc file which is executed when zsh starts.


However, later in your post you state:


/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh


so now you are explicitly running your curl command under BASH.


Guess what? BASH doesn't give two hoots what configuration options you use in ZSH. They are two completely different beasts. Therefore the first command (editing your $PATH) has no effect.


You need to decide if you want to use BASH moving forwards (change your Terminal.app preferences to use BASH rather than ZSH), or if you want to use ZSH (in which case execute your curl command in your zsh shell rather than invoking a new bash shell.


Confused yet? I did warn you.


No one can tell you the 'right' way to do this. TBH it's one of the bigger problems with homebrew (et. al.). While they do offer a peek into the world of UNIX executables, you are somewhat at the mercy of the homebrew guys and how they think/prefer things to be done. If you don't follow their model 100% (e.g. bash vs. zsh), that's OK, but you need to know enough of the gears/knobs/buttons to be able to tweak it for your environment.


That said, zsh has been the default Mac OS shell for a while now, so I'm surprised anyone is giving you BASH-specific advice, unless you're following an out of date support article, or that homebrew is still assuming bash.

Jan 4, 2021 1:33 PM in response to Camelot

Merci beaucoup pour vos explications


Je comprends mieux maintenant le fonctionnement de shell,


Cela dit… Y a-t-il un moyen pour réinitialiser ce fichier .zshrc?


Concernant homebrew… en effet, c’est vraiment la galère pour un amateur comme moi, et pour cela que j’ai voulu le désinstaller,


Sauf que… voilà que ce problème me tombe dessus,


Encore merci pour ton interaction.

Jan 4, 2021 1:35 PM in response to Camelot

Thank you very much for your explanations

I now understand better how shell works,

Having said that ... Is there a way to reset this .zshrc file?

Regarding homebrew ... indeed, it's really a hassle for an amateur like me, and that's why I wanted to uninstall it,

Except that ... this problem is falling on me,

Thank you again for your interaction.

problem with terminal on Mac os: (Dquote cmdsubst)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.