zsh terminal error

Getting below when opening new terminal


Last login: Fri Aug 25 20:53:37 on ttys000

/Users/pratap.bobba/.zshrc:export:1: not valid in this context: Code.app/Contents/Resources/app/bin:/opt/homebrew/bin:/opt/homebrew/bin

pratap.bobba@Prataps-MacBook-Pro ~ %


and when i execute anything getting same error


Last login: Fri Aug 25 20:53:37 on ttys000


/Users/pratap.bobba/.zshrc:export:1: not valid in this context: Code.app/Contents/Resources/app/bin:/opt/homebrew/bin:/opt/homebrew/bin


pratap.bobba@Prataps-MacBook-Pro ~ % brew -help


zsh: command not found: brew


pratap.bobba@Prataps-MacBook-Pro ~ % terraform -help


zsh: command not found: terraform


pratap.bobba@Prataps-MacBook-Pro ~ % terraform


zsh: command not found: terraform


pratap.bobba@Prataps-MacBook-Pro ~ %




Below is the content of zshrc


export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/opt/homebrew/bin:/opt/homebrew/bin -

autoload -U +X bashcompinit && bashcompinit

complete -o nospace -C /opt/homebrew/bin/terraform terraform


MacBook Pro (M1, 2020)

Posted on Aug 25, 2023 8:46 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 25, 2023 2:30 PM

brew might be installed. I see that in his .bashrc, one of the components that he was trying to add to his PATH


export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/opt/homebrew/bin:/opt/homebrew/bin -
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /opt/homebrew/bin/terraform terraform


was


/Applications/Visual Studio Code.app/Contents/Resources/app/bin


The error message from zsh complained about the text following the first non-escaped space. That was the text that included the homebrew directory names. So they never got added to the working PATH.


If the OP edits the .bashrc to include backslashes (as so), then exits Terminal and restarts it (to get a new shell that's started up with the revised .bashrc), zsh might stop complaining and the command may work.


/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin


[Sorry for the double post. I hit 'Post' by mistake, then the forum software told me I'd have to wait to save any updates.]

Similar questions

5 replies
Question marked as Top-ranking reply

Aug 25, 2023 2:30 PM in response to John Galt

brew might be installed. I see that in his .bashrc, one of the components that he was trying to add to his PATH


export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/opt/homebrew/bin:/opt/homebrew/bin -
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /opt/homebrew/bin/terraform terraform


was


/Applications/Visual Studio Code.app/Contents/Resources/app/bin


The error message from zsh complained about the text following the first non-escaped space. That was the text that included the homebrew directory names. So they never got added to the working PATH.


If the OP edits the .bashrc to include backslashes (as so), then exits Terminal and restarts it (to get a new shell that's started up with the revised .bashrc), zsh might stop complaining and the command may work.


/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin


[Sorry for the double post. I hit 'Post' by mistake, then the forum software told me I'd have to wait to save any updates.]

Aug 25, 2023 10:32 AM in response to shakeel2302

Looks like the OP is trying to install an Open Source tool called Terraform on his Mac, using the Homebrew package manager. It also looks like he has an error in his .zshrc (shell initialization script) file, and/or is attempting to run this Homebrew without having installed it first.


TecAdmin.net – How to Install Terraform on macOS with Homebrew


Now as to why he wants to install Terraform, ask him…

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

zsh terminal error

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