0

I tried installing hombrew for mac os and faced some issues while adding to path, now terminal welcomes me with this messages, how can I fix it?

.zprofile:export:4: not valid in this context: export HOMEBREW_PREFIX
.zshrc:export:1: not valid in this context: Support/JetBrains/Toolbox/scripts

.zprofile :

# Added by Toolbox App
export PATH="$PATH:/Users/randus/Library/Application Support/JetBrains/Toolbox/scripts"eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(/opt/homebrew/bin/brew shellenv)"

.zshrc :

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/randus/Library/Application Support/JetBrains/Toolbox/scripts
8
  • Possible duplicate: unix.stackexchange.com/q/208607/4667 -- see also unix.stackexchange.com/… Commented Sep 2, 2022 at 15:14
  • 1
    Please add the contents of .zprofile and .zshrc to your question. Commented Sep 2, 2022 at 16:51
  • This may not be what you want to hear, but FWIW my opinion - after using both homebrew and MacPorts for several years - is this: MacPorts is a far better choice for a macos package manager than homebrew. But don't take my word for it - research this yourself.
    – Seamus
    Commented Sep 2, 2022 at 16:59
  • 1
    FWIW, Those are the errors you'd get if ~/.zprofile contained: export 'export HOMEBREW_PREFIX' and ~/.zshrc contained export Support/JetBrains/Toolbox/scripts Commented Sep 2, 2022 at 17:50
  • 1
    @MarlonRichert, not sure what you mean, shwordsplit is about splitting parameter expansions and has never been on by default except in sh/ksh emulation. zsh has always done IFS-splitting on command substitutions in list context. The change I'm refering to is this one which makes it that export var=$(cmd) is no longer a list context as var=$(cmd) is interpreted as assignment Commented Sep 5, 2022 at 7:49

1 Answer 1

3

Put space between

export PATH="$PATH:/Users/randus/Library/Application Support/JetBrains/Toolbox/scripts"

and

eval "$(/opt/homebrew/bin/brew shellenv)"

Steps:

  • nano /Users/randus/.zprofile
  • Add space after scripts", so finally your zprofile contents should look like
    export PATH="$PATH:/Users/randus/Library/Application Support/JetBrains/Toolbox/scripts" eval "$(/opt/homebrew/bin/brew shellenv)"
    
  • Control + O
  • Enter
  • Control + X
  • Restart terminal
1
  • Or path+=( ~/'Library/Application Support/JetBrains/Toolbox/scripts') for a more zsh-y way to add a directory to $PATH. Commented Sep 7, 2022 at 14:14

You must log in to answer this question.

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