# Rstan Compilation Hangs

**URL:** <https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150>\
**Category:** RStan\
**Created:** [May 14, 2020, 5:57pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150 "2020-05-14T17:57:46Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [May 15, 2020, 1:41am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/21 "2020-05-15T01:41:07Z")

</div>

Maybe R-SIG-MAC, but I wouldn’t be surprised if they tell you that only XCode is supported.

---

<div class="post-metadata">

**Author:** ![jsilve24](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jsilve24/32/179_2.png) [@jsilve24](https://discourse.mc-stan.org/u/jsilve24)\
**Post date:** [May 15, 2020, 1:49am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/22 "2020-05-15T01:49:04Z")

</div>

@bgoodri  
I really appreciate the help.  
At this point I am at the – l just need a drink – phase of this endeavor. Posted here: [https://stackoverflow.com/questions/61810359/r-version-4-0-0-os-x-catalina-rcpp-installation-chaos](https://stackoverflow.com/questions/61810359/r-version-4-0-0-os-x-catalina-rcpp-installation-chaos)

Will try again tomorrow.

---

<div class="post-metadata">

**Author:** ![jsilve24](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/jsilve24/32/179_2.png) [@jsilve24](https://discourse.mc-stan.org/u/jsilve24)\
**Post date:** [May 16, 2020, 10:32pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/23 "2020-05-16T22:32:13Z")

</div>

Finally got it working. To anyone else with this problem – you are not going to like my solution. Delete all of /usr/local/. Reinstall all developer software again from scratch. The slash and burn solution…

Still really pissed about no openMP support. Going to switch to linux soon. Any advice on good linux distro for R development? Anything particularly stable?

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [May 17, 2020, 1:34am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/24 "2020-05-17T01:34:22Z")

</div>

Almost all of the Linux distributions have a “stable” release, but the version of R in the repositories is usually behind the version of R on CRAN. That is not so much of a problem because R and R package development is usually done with the subversion version of R.

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 3, 2020, 12:05pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/25 "2020-09-03T12:05:24Z")

</div>

Hi, I have problem to run Stan on mac by RStan.  
I install rstan by structure for mac Catalina but I still can not run after installing R-4.0.2 on macOS Catalina.  
R go to hang after us a test function as  
fit \<- stan(file = ‘schools.stan’, data = schools\_dat)  
please help me.

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 3, 2020, 12:09pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/26 "2020-09-03T12:09:14Z")

</div>

when I run “Rcpp::sourceCpp(‘/Users/arman-artin/helloworld.cpp’)” , I see the following result:

```
        SEXP data = Parent::get__();
             ^

```

1 warning generated.

> hello\_world()  
> Hello World!

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 3, 2020, 12:16pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/27 "2020-09-03T12:16:53Z")

</div>

I have long runtime and see my pages on mac as:

 ![Screen Shot 2020-09-03 at 4.44.44 PM](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/5/59b348f506ab5b69b747193781c14f63a321bf8d.jpeg)

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [September 3, 2020, 4:10pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/28 "2020-09-03T16:10:06Z")

</div>

Do

```
remotes::install_github("bgoodri/inline")
example(stan_model, package = "rstan", run.dontrun = TRUE)

```

and tell us what are the lines right before it hangs.

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 4, 2020, 4:57am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/29 "2020-09-04T04:57:24Z")

</div>

I run the command: ```  
remotes::install\_github(“bgoodri/inline”)  
example(stan\_model, package = “rstan”, run.dontrun = TRUE)  
but I have problem, R go to hangs long time! without any result and the result is as follows:

 ![Screen Shot 2020-09-04 at 9.22.11 AM](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/b/b4abf3cec71da810953c9f20347719684e6de7ac.png)

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 4, 2020, 5:23am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/30 "2020-09-04T05:23:02Z")

</div>

when I install RStan package I see many warning, but it is done. Is it the problem?

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 6, 2020, 8:01pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/31 "2020-09-06T20:01:10Z")

</div>

please help me about this.

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [September 9, 2020, 6:48pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/32 "2020-09-09T18:48:20Z")

</div>

You can install inline from CRAN now, but I still don’t know why there seems to be hanging. There is another thread about it at

> [@Problem with R update to 4.0.2 on MacOS: stan stuck in model fit](https://discourse.mc-stan.org/t/problem-with-r-update-to-4-0-2-on-macos-stan-stuck-in-model-fit/17664/26):
>
> Thanks much. I’m reporting outputs here from a machine running Mohave, but I get the same behavior on a different machine I just upgraded to Catalina (and did a fresh R and RStan install on). \> Rcpp::evalCpp("1 + 1", verbose = TRUE) Generated code for function definition: -------------------------------------------------------- #include \<Rcpp.h\> using namespace Rcpp; // [[Rcpp::export]] SEXP get\_value(){ return wrap( 1 + 1 ) ; } Generated extern "C" functions ---------------------------…

---

<div class="post-metadata">

**Author:** ![omid\_karimi](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/omid_karimi/32/9228_2.png) [@omid\_karimi](https://discourse.mc-stan.org/u/omid_karimi)\
**Post date:** [September 10, 2020, 5:36pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/33 "2020-09-10T17:36:45Z")

</div>

Thanks, can you guide me about the Makevar file? I must define it before installing RStan package?

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [September 15, 2020, 12:33pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/34 "2020-09-15T12:33:05Z")

</div>

With R 4.x, you shouldn’t need a Makevars file but then again, it should not be hanging.

---

<div class="post-metadata">

**Author:** ![gferraz](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gferraz/32/8370_2.png) [@gferraz](https://discourse.mc-stan.org/u/gferraz)\
**Post date:** [November 3, 2020, 1:32am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/35 "2020-11-03T01:32:45Z")

</div>

I am having the same problem. Compile commands always leave me hanging. I tried removing R completely and re-installing from brew. I installed rstan in many from source and from binary file. Nothing seems to work.

Has there been any progress on this since @sjilve24 recommended delete all of /usr/local/ and reinstall all developer software again from scratch?

Thank you

---

<div class="post-metadata">

**Author:** ![bgoodri](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bgoodri/32/4451_2.png) [@bgoodri](https://discourse.mc-stan.org/u/bgoodri)\
**Post date:** [November 3, 2020, 3:33am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/36 "2020-11-03T03:33:40Z")

</div>

Deleting all of /usr/local seems extreme, but it is necessary with R 4.x to make sure the compiler is not using anything from /usr/local/clang\* .

---

<div class="post-metadata">

**Author:** ![gferraz](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gferraz/32/8370_2.png) [@gferraz](https://discourse.mc-stan.org/u/gferraz)\
**Post date:** [November 3, 2020, 11:32am UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/37 "2020-11-03T11:32:29Z")

</div>

Thanks. I have two questions: 1) what else can I expect to be affected by the deletion of the /usr/local/ content? Does it usually have content that goes beyond our use of R and development tools? 2) By ‘reinstall all developer software’ is it meant to remove and re-install the MacOS Xcode?

---

<div class="post-metadata">

**Author:** ![gferraz](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gferraz/32/8370_2.png) [@gferraz](https://discourse.mc-stan.org/u/gferraz)\
**Post date:** [November 5, 2020, 11:48pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/38 "2020-11-05T23:48:04Z")

</div>

But, here is no clang\* inside my /usr/local directory.  
I only see a clang directory inside  
Users/Shared/Previouly Relocated Items/Security/Developer/usr/lib/

---

<div class="post-metadata">

**Author:** ![gferraz](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gferraz/32/8370_2.png) [@gferraz](https://discourse.mc-stan.org/u/gferraz)\
**Post date:** [November 5, 2020, 11:58pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/39 "2020-11-05T23:58:38Z")

</div>

> [@jsilve24](#):
>
> Finally got it working. To anyone else with this problem – you are not going to like my solution. Delete all of /usr/local/. Reinstall all developer software again from scratch. The slash and burn solution…
> 
> Still really pissed about no openMP support. Going to switch to linux soon. Any advice on good linux distro for R development? Anything particularly stable?

Hi, When you write ‘reinstall all developer software again from scratch’ do you mean all of Xcode as well?

---

<div class="post-metadata">

**Author:** ![gferraz](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/gferraz/32/8370_2.png) [@gferraz](https://discourse.mc-stan.org/u/gferraz)\
**Post date:** [November 8, 2020, 7:41pm UTC](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150/40 "2020-11-08T19:41:32Z")

</div>

> [@bgoodri](#):
>
> Deleting all of /usr/local seems extreme, but it is necessary with R 4.x to make sure the compiler is not using anything from /usr/local/clang\* .

Well, it did not work. I can’t believe it. I deleted all the content of /user/local, uninstalled xcode and R (using the AppClener for R). Then I restarted the machine, re-installed xcode, R (from the CRAN site) and followed all the instructions in [RStan Getting Started · stan-dev/rstan Wiki · GitHub](https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started) to the letter.

And yet, again, I was left hanging on compilation.

This is rather unsettling. I am thinking about formatting my HD and really starting from scratch.

Does anyone know where one can appeal for help with this problem?

[Previous page](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150.md?page=1)

[Next page](https://discourse.mc-stan.org/t/rstan-compilation-hangs/15150.md?page=3)
