title: R parallel makeCluster() hangs infinitely on Mac
body: <p>I came across some problem when I was trying to use <code>parallel</code> package in R on my Mac. </p>
  
  <p>Here is how the parallel package works normally. </p>
  
  <pre><code>cl = makeCluster(2) # Using 2-core parallel as an example
  # Your parallel code
  stopCluster(cl)
  </code></pre>
  
  <p>When I ran this code, the <code>cl = makeCluster(2)</code> <strong>hangs infinitely</strong>. I was trying to solve it but failed. I also referred to some other posts. Several potential reasons includes not enough memory, installation error, etc. They do not seems to be the problem here, as I restarted sessions, reinstalled R, but the problem remained. </p>
  
  <p>I guess the problem is about the permission when R tried to connect to cores. Here is what I found out. I used <code>future</code> package to see the specific process of connecting to cores. Attached are the code and its return. </p>
  
  <pre><code>cl &lt;- future::makeClusterPSOCK(2, verbose = TRUE)
  </code></pre>
  
  <blockquote>
    <p>Workers: [n = 2] ‘localhost’, ‘localhost’
    Base port: 11303
    Creating node 1 of 2 ...
    - setting up node
    Starting worker #1 on ‘localhost’: '/Library/Frameworks/R.framework/Resources/bin/Rscript' --default packages=datasets,utils,grDevices,graphics,stats,methods -e 'parallel:::.slaveRSOCK()' MASTER=localhost PORT=11303 OUT=/dev/null TIMEOUT=2592000 XDR=TRUE<br>
    Waiting for worker #1 on ‘localhost’ to connect back</p>
  </blockquote>
  
  <p>The problem is the localhost never connects back ...</p>
  
  <p>The following my the session info. I hope this helps. </p>
  
  <blockquote>
    <p>R version 3.5.1 (2018-07-02).<br>
    Platform: x86_64-apple-darwin15.6.0 (64-bit).<br>
    Running under: macOS High Sierra 10.13.6.       </p>
    
    <p>Matrix products: default.<br>
    BLAS:        /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib.<br>
    LAPACK:     /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib</p>
    
    <p>locale:<br>
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8</p>
    
    <p>attached base packages:<br>
    [1] stats     graphics  grDevices utils     datasets  methods   base     </p>
    
    <p>loaded via a namespace (and not attached):<br>
    [1] compiler_3.5.1   parallel_3.5.1   tools_3.5.1      listenv_0.7.0       codetools_0.2-15 digest_0.6.16<br>
    [7] globals_0.12.2   future_1.9.0</p>
  </blockquote>
  
  <p>It's interesting that the same code works on my old Mac machine (same OS but the hardware is older). I have no idea what is happening here. Any help is appreciated! Thanks! </p>