0
votes

adding export PATH= $PATH:~/omnetpp-5.6.2/bin to .zshrc in MacOS gives the following error :

.zshrc:export:193: not valid in this context: /usr/local/opt/gcc/bin:/usr/local/bin/python3:/usr/local/opt/gcc/bin:/usr/local/bin/python3:/Users/kaytlyn/anaconda3/bin:/Users/kaytlyn/anaconda3/condabin:/usr/local/opt/gcc/bin:/usr/local/bin/python3:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/Users/kaytlyn/anaconda3/bin:/usr/local/go/bin/go:/Users/kaytlyn/anaconda3/bin:/usr/local/go/bin/go:/Users/kaytlyn/anaconda3/bin:/usr/local/go/bin/go:~/omnetpp-5.6.2/bin prompt_status:5: command not found: wc

I want to add this path so that I don't have to cd to that directory every time to run it. How do solve this problem? Thanks in advance!!

1
You seem to have a space after the equal sign.... - user1934428

1 Answers

0
votes

~ does not get expanded to /Users/kaytlyn if you add it that way. Try this instead:

# Use the array version instead of the scalar.
# -U eliminates duplicates.
export -U PATH path+=( ~/omnetpp-5.6.2/bin )

See http://zsh.sourceforge.net/Doc/Release/Parameters.html#Parameters-Used-By-The-Shell