`system` doesn't have access to path in RStudio

I'm trying to send a system command in RStudio with the system command. I am trying to interface with pixi.

If I run this in my terminal, it works irrespective of whether I use sh/bash/zsh/nushell:

❯ r

R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin20

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> system("pixi -V")
pixi 0.47.0
>

Similarly, if I run pixi -V in the RStudio Terminal, it also works. Likewise, it works in both the Terminal and console in Positron.

But I get an error if I run it in the R console in RStudio:

> system("pixi -V")
sh: pixi: command not found
Warning message:
In system("pixi -V") : error in running command

So a couple of questions:

  • How come stuff on PATH everywhere else is not on PATH in the shell called by system?
  • How can I make the above example work? Can I make a function that automatically adds it to the PATH of whichever shell RStudio uses?

I'm on RStudio Version 2025.05.0+496 (2025.05.0+496).