# How to compile R/igraph from source, with all features enabled?

**URL:** <https://igraph.discourse.group/t/how-to-compile-r-igraph-from-source-with-all-features-enabled/1190>\
**Category:** Development\
**Tags:** R\
**Created:** [19 April 2022 12:43 UTC](https://igraph.discourse.group/t/how-to-compile-r-igraph-from-source-with-all-features-enabled/1190 "2022-04-19T12:43:36Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [19 April 2022 13:00 UTC](https://igraph.discourse.group/t/how-to-compile-r-igraph-from-source-with-all-features-enabled/1190/5 "2022-04-19T13:00:00Z")

</div>

## macOS

Choose a section depending on whether you want to use developer tools from the official RTools, MacPorts, or Homebrew.

### RTools

**TODO**

Get the developer tools from:

- [Tools - R for Mac OS X - developer's page - GNU Fortan for Xcode](https://mac.r-project.org/tools/)

Download the dependencies (GLPK and libxml2 libraries) from:

- [Optional Libraries, Frameworks and Applications for macOS](https://mac.r-project.org/libs-4/) (Intel)
- [Optional Libraries, Frameworks and Applications for macOS (arm64)](https://mac.r-project.org/libs-arm64/) (ARM)

### MacPorts

**Warning:** If you are using the official R distribution, using other compilers than what come with RTools is not officially supported by the R maintainers.

Install compilers and libraries:

```auto
sudo port install clang-14 gcc11 libxml2 glpk

```

We need to ensure that R will use the compilers and libraries from MacPorts. Place the following in `~/.R/Makevars`:

```auto
CC = /opt/local/bin/clang-mp-14
CXX = /opt/local/bin/clang++-mp-14
FC = /opt/local/bin/gfortran-mp-11
F77 = /opt/local/bin/gfortran-mp-11
FLIBS = -L/opt/local/lib/gcc11 -lgfortran -lquadmath -lm
CPPFLAGS=-I/opt/local/include
LDFLAGS=-L/opt/local/lib

```

If you install different versions of compilers than what is shown above, the contents of `Makevars` will need to be updated accordingly.

### Homebrew

**Warning:** If you are using the official R distribution, using other compilers than what come with RTools is not officially supported by the R maintainers.

**TODO**

---

_[View the full topic](https://igraph.discourse.group/t/how-to-compile-r-igraph-from-source-with-all-features-enabled/1190)._
