I'm currently struggling with an error in terminal in Mac. Can someone help me to fix it?
I already tried some other forum solutions (using export and other similar solutions), but none of them was useful.
Here's the error
/Users/alessandromasala/.zshrc:export:17: not valid in this context: Preview.app/Contents/Public:/Library/TeX/texbin:/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
This is the content of my .zshrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/alessandromasala/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/alessandromasala/miniconda3/etc/profile.d/conda.sh" ]; then
. "/Users/alessandromasala/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/alessandromasala/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH=/opt/homebrew/bin:/Users/alessandromasala/miniconda3/bin:/Users/alessandromasala/miniconda3/condabin:/Users/alessandromasala/.pyenv/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion Tech Preview.app/Contents/Public:/Library/TeX/texbin:/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
The problem is that on line 17 (the export PATH=/opt/homebrew/bin:...
command), the spaces in VMware Fusion Tech Preview.app
need to be quoted or escaped. Actually, it looks to me like that command got prematurely expanded, since it's replacing the entire PATH
value rather than just adding to it like normal (which means that, for example, it's replacing whatever changes the earlier conda setup part did).
I suspect that entire line should be replaced by:
export PATH="/opt/homebrew/bin:$PATH"