0

I am trying hard to wrap my head around zsh "upgrade" from bash in macOS Catalina. Most of the things are great, actually. However, I cannot figure out why I am experiencing difficulties, like accessing Anaconda rather than built in Python despite the fact that I put the path to it:

# Anaconda3 2019.10
export PATH="/Library/Frameworks/Python.framework/anaconda3/bin:$PATH"

But if I have this too, under Anaconda's path, then the system does not "see" Anaconda anymore (I've commented it out, for now):

# Local path:
# export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:$PATH"

Also, I have some odd line added to gcc (again, I commented out the odd line):

# Setting gcc compiler
export PATH="/usr/local/gcc-9.2/bin:$PATH"
# export CC="/usr/local/gcc-9.2/bin"

With lines commented out things are working now. But can anyone explain what is wrong in them and what, specifically, export CC should to on top of the export PATH line?

Thanks!

2
  • Which anaconda installation method did you use? (e.g. brew cask, original Anaconda open source installer etc.)
    – klanomath
    Commented May 4, 2020 at 10:39
  • I suggest you to remove Catalina from your question since this is a more general question about zsh and PATH.
    – athena
    Commented May 4, 2020 at 16:18

1 Answer 1

2

Since the variable setting you want to achieve are both to be run once only per session and not for every subshell, you have to place their initialisation definition within .zprofile and not within .zshrc.

Here are the fixed version of your settings which should work:

# Anaconda3 2019.10
export PATH="/Library/Frameworks/Python.framework/anaconda3/bin:${PATH}:/usr/local/bin"

Here my explanation is I bet you have 2 versions of anaconda the older one being located within /usr/local/bin.

# Setting gcc compiler
export PATH="/usr/local/gcc-9.2/bin:${PATH}"
export CC="/usr/local/gcc-9.2/bin/gcc"

Here my explanation is that the CC variable should contain not the PATH where to find gcc but the exact pathname of the compiler.

If you want to check the correctness of your modifications, don't exit your session. Just enter in any terminal:

. ~/.zprofile
8
  • Thanks for your great explanations! So, essentially, I should mv my .zshrc to .zprofile, right? Some additional infos: - I do not have Anaconda in /usr/local/bin/
    – striatum
    Commented May 4, 2020 at 13:01
  • 1
    1st question: you have to put in .zprofile everything to be done just once per session, you have to put in .zshrc everything depending of the shell level. For my use of shell I don't use .zshrc but this is my case of use.
    – athena
    Commented May 4, 2020 at 14:09
  • 1
    2nd question: then it could be another component used indirectly by anaconda. For example it could be the wrong python used which is incompatible with anaconda. You could check this particular hypothesis by typing type python.
    – athena
    Commented May 4, 2020 at 14:36
  • 2nd Q: When I uncomment the line above with path to /usr/bin/ it then gives me the macOS version of Python which is 2.7.x. I wonder why isn't that already removed completely... 🤔
    – striatum
    Commented May 4, 2020 at 14:49
  • 1
    You are right, this version smells musty of mummies 😡.
    – athena
    Commented May 4, 2020 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .