'(eval):export:1: not valid in this context

I run "brew install hadoop" without any configuration, after that, I generated a public key by using the following lines :

ssh-keygen -t rsa -P ""
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys

and then I tried "ssh localhost",something went wrong and I tried that again, it worked, but I got this when I open iIterm2 every time.

Last login: Sun Jul 21 16:44:36 on ttys001
You have new mail.
(eval):export:1: not valid in this context: Fusion.app/Contents/Public:/Library/TeX/texbin:/opt/X11/bin:/Users/amber/opt/phantomjs/bin:/Users/amber/opt/adb:/usr/local/android-sdk-macosx//tools:/usr/local/android-sdk-macosx//platform-tools:/usr/local/android-sdk-macosx//build-tools/27.0.3//Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Applications/VMware

Here is part of the zsh script:

# Path to your oh-my-zsh installation.
export ZSH=/Users/amber/.oh-my-zsh
...
eval export PATH="/Users/amber/.pyenv/plugins/pyenv-virtualenv/shims:${PATH}";
export PYENV_VIRTUALENV_INIT=1;
_pyenv_virtualenv_hook() {
  local ret=$?
  if [ -n "$VIRTUAL_ENV" ]; then
    eval "$(pyenv sh-activate --quiet || pyenv sh-deactivate --quiet || true)" || true
  else
    eval "$(pyenv sh-activate --quiet || true)" || true
  fi
  return $ret
};
typeset -g -a precmd_functions
if [[ -z $precmd_functions[(r)_pyenv_virtualenv_hook] ]]; then
  precmd_functions=(_pyenv_virtualenv_hook $precmd_functions);
fi
export PATH="/usr/local/opt/nss/bin:$PATH"

export PATH="$HOME/.jenv/bin:$PATH"
eval "($(jenv init -))"

What exactly is the problem? Does the message matter? Any help will be appreciated.



Solution 1:[1]

What worked for me was removing /etc/paths.d/com.vmware.fusion.public, look for other files there that may correspond to entries in (eval):export:1: not valid in this context: Fusion.app/Contents/Public:...

Solution 2:[2]

It is difficult not knowing which eval the error comes from.

Regarding the first one before the export (config line 4), I don't understand why it is there. It just seems to be a regular prepending to the $PATH which normally does not require eval.

Regarding the last eval for jenv, the line on their website is different from yours, it says:

eval "$(jenv init -)"

It is worth changing it just in case.

Also it would not make it invalid but you have in your $PATH a few things that you may want to look at. Paths with double slash (most likely a typo) work at least on Zsh but it is better if you make sure there is only slash one just in case.

Also your first one Fusion.app/Contents/Public is a relative path. If you want it to work everywhere you would need to put the absolute path instead. Maybe I am being confused and I don't understand the specifics but in this case the applications there are gonna be found only if you are in the directory containing Fusion.app. Personally the only relative path I have in $PATH is . which is a convenient one to have first.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stoya_pl
Solution 2 Mig