The command system() does open a shell, but not necessarily the same as the default shell of Terminal. If I'm not mistaken, on Mac OS by default the shell is zsh, here you can see system() called sh.
system() is a bit of a pain, and best avoided if possible, for conda is there a reason you're not using {reticulate}? This package can directly interact with conda, taking care of some details for you (and letting you specify the path to an existing conda installation, or reinstalling one for you).
Thanks for the response. I agree system() can be a bit of a pain. I am trying to use an R package which calls a non-R package I have installed on zsh using mamba, so its not actually my code I am trying to use.
So not sure how to really overcome the problem at the moment...
UPDATE:
I changed the default shell to bash in RStudio Global Options, opened a Terminal and ran source <path to conda>/bin/activate followed by conda init bash.
This resulted in conda being available in my bash terminal and thought this meant I would get success.
However it still did not work. , and when I run system(paste('echo $PATH')) the correct paths are not present. Frustrating.
So the solution I found was to copy the output of echo $PATH from the Terminal into my .Rprofile and then everything seems to work calling system(paste('conda -V') for example.
It seems that system() is called based on the paths known to R on start up, so I needed to add them to the .Rprofile as well.
Great that you figured it out. I think another approach (based on this answer, but that I can not test at this time) would be to call your normal shell, zsh if I'm not mistaken. Something like: