Installing RStan on macOS High Sierra: PKI issue?


Operating System: macOS High Sierra (10.13.3)
Interface Version: 2.17.3
Compiler/Toolkit: clang (XCode)

I’ve made a PKI issue, but I’m wondering if anyone else has run into this problem on High Sierra: I’m unable to install RStan because (I believe) shinystan depends on rsconnect which depends on PKI, and I can’t install PKI due to an OpenSSL headers issue.

Any suggestions?



Are you using homebrew? If so, try brew install openssl in a terminal then try installing PKI.


I did try that, plus a ~/.R/Makevars file that looked like this:

CFLAGS = -g -O3 -Wall -pedantic -mtune=native -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include
CXXFLAGS = -g -O3 -Wall -pedantic -mtune=native -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include
LDFLAGS = -L/usr/local/opt/openssl/lib -L/usr/local/opt/gettext/lib

Same problem.

Do those flags look right? The PKI install complains while checking for RSA_generate_key_ex in openssl/rsa.h, but it’s definitely there in /usr/local/opt/openssl/include/openssl/rsa.h.


Huh, running xcode-select --install fixed the problem. I guess I hadn’t redone that since upgrading to Sierra? (I definitely already have Xcode installed and have installed the command line tools before.) Funny that installing RStan is the first time I’ve noticed a problem from missing XCode command line tools, but at any rate, I’m all set now. Thanks!