Abhishek Shah
Abhishek Shah

Reputation: 41

Unnecessary texts show up on starting terminal

I did something for installing a particular version of java and adding it to the path by looking at and reading various articles. But for a few days now, whenever I open my Mac terminal, this is what I get, this text. How can I remove it?

This is what I see on my Mac terminal.

Please click here for the terminal picture

HOME=/Users/abhishekshah
LANG=en_US.UTF-8
LOGNAME=abhishekshah
OLDPWD=/Users/abhishekshah
PATH=/usr/bin:/bin
PWD=/Users/abhishekshah
SHELL=/bin/zsh
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.SwNOWQsVIR/Listeners
TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=444
TERM_SESSION_ID=D558C190-743E-4CA7-9E11-6F4D7403B0BD
TMPDIR=/var/folders/5z/8hmt3tz15n1fchdd_c497qh00000gn/T/
USER=abhishekshah
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
__CFBundleIdentifier=com.apple.Terminal
HOME=/Users/abhishekshah
LANG=en_US.UTF-8
LOGNAME=abhishekshah
OLDPWD=/Users/abhishekshah
PATH=/usr/bin:/bin
PWD=/Users/abhishekshah
SHELL=/bin/zsh
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.SwNOWQsVIR/Listeners
TERM=xterm-256color
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=444
TERM_SESSION_ID=D558C190-743E-4CA7-9E11-6F4D7403B0BD
TMPDIR=/var/folders/5z/8hmt3tz15n1fchdd_c497qh00000gn/T/
USER=abhishekshah
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
__CFBundleIdentifier=com.apple.Terminal
abhishekshah@Abhisheks-MacBook-Pro-2 ~ %

Upvotes: 3

Views: 1796

Answers (6)

Afnan
Afnan

Reputation: 5

Remove break between export and path This worked for me

Upvotes: 0

chiekemi
chiekemi

Reputation: 41

Had the exact same problem and just solved it. In the terminal run zsh -x and scroll down to see exactly what file is causing the unnecessary export to the terminal. For me, this was in my output:

+add-zsh-hook:92> autoload -- shell_session_update
+/Users/chie/.zshrc:1> export
DISPLAY=/private/tmp/com.apple.launchd.ADcsvecDjX/org.xquartz:0
HOME=/Users/chie
LANG=ja_JP.UTF-8
...

...which meant that the issue was in the file ~/.zshrc which I had mistakenly edited (I had accidentally put a line break between export and PATH)

Upvotes: 1

tcscorp
tcscorp

Reputation: 31

Open your ~/.zshrc or some other zsh startup file and make sure you have no explicit line break on the variables you are exporting. In other words, the variables you are exporting have to be inline.

Upvotes: 3

Shubham
Shubham

Reputation: 181

Faced this issue after I edited .zshrc file to add path. I had added this line:

export PATH = "$PATH:YOUR_PATH"

and then ran command source .zshrc which gave this error .zshrc:2: bad assignment and this error was stuck in shell even after restart since .zshrc is a startup file(runs on shell start).

On searching a lot I found the issue here

The assignments in Bash commands and scripts must not have white space characters around the = operator.

after removing white spaces around = operator the issue was resolved.

Note: Also check that statements should not contain newline characters.

Upvotes: 1

Jon
Jon

Reputation: 9

Open Terminal and enter

rm .zshenv

It will fix your issue but it may cause other issues. Copy the contents of your .zshenv file before executing the remove command

Upvotes: -1

rob mayoff
rob mayoff

Reputation: 386038

Probably the installer added an env or printenv command to your ~/.zshrc or some other zsh startup file. Check section “STARTUP/SHUTDOWN FILES” in the zsh man page for the complete list of files you might need to inspect.

Upvotes: 0

Related Questions