Rstudio/R can't find path for sh

Since you're on a Mac, you shouldn't need external requirements (see the igraph docs requirements section here).

Did you by chance install R using homebrew? If so, take a look here

Summary of problem:

Unfortunately, when R is installed in this way it is not compatible with the CRAN package binaries, which means you must build and install all packages from source.
Don't worry, they explain the fix there as well.

To isolate some variables here, does this work for you in R but not in RStudio? (see FAQ below for disambiguation)