Error in install package "semPlot" in R

Hi everyone!
I am new in R.
I have a problem with installing package "semPlot".
Error: package or namespace load failed for ‘semPlot’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘igraph’

I tried install.packages("semPlot", dependencies=TRUE) but it dose not work.
I also tried solution from Mr Macro7 like this:

  • step1: downloaded home brew at https://brew.sh/, then running from terminal application:
    /usr/bin/ruby -e "(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -step2: sudo chown -R (whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions
    -step3:
    brew install cmake gcc
    After that, trying to install "qgraph" on R Studio, it finally worked and as well as library(semPlot).
    however, I do not know what I have to download from berew? and the command "brew install cmake gcc" does not work as well.

My MacOS Catalina 10.15.7
Thank you so much for your help.

This was asking you to install igraph

When you used dependencies=TRUE R tried to install it for you but very likely faild because you where missing system dependencies.

Then you installed the system dependencies (C compilers) with Homebrew and probably that solved the source of your issues.

This is my best guest of what happened, but package installation issues are very specific so next time an error message asks you to install a package, try to install just that package and see if you get an specific error message so you can keep tracking the root problem.