Why does my terminal start up with "(eval):export:1: not valid in this context"?

When I open my terminal, it shows up with the error

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

I can't figure out what is causing this error, mainly because I don't have Postgres installed. It seems like the error might be coming from VMware Fusion, which I do have.

I'm using macOS 10.14.5, zsh 5.3, I have VMware Fusion 11.1.0 installed. I used to have Postgres installed (for working with Heroku), but I realized I didn't need it for my project, so I deleted it.

2

2 Answers

I get something similar:

(eval):export:1: not valid in this context: -A

In my case, it started when the gcloud installer modified my .zshrc to add this line:

if [ -f '/Users/matt/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/matt/Downloads/google-cloud-sdk/completion.zsh.inc'; fi

I get the error whenever I try to tab-complete gcloud commands.

Commenting out that line makes the error go away. Did a VMWare or Postgres installer modify your .zshrc? You might need to remove whatever modifications it made.

As it turns out, the issue was that my path included Postgress and VMWare despite uninstalling them. They were not added in .zshrc, but actually in /etc/paths.d (which is a directory). Inside this directory, there were 3 files, two of them named com.vmware.fusion.public and postgresapp. I simply deleted these files from /etc/paths.d, and now my zsh starts up with no error!

Thanks @MatrixManAtYrService for starting me down the path to figure that out.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like