Skip to content

Instantly share code, notes, and snippets.

@nicebread
Last active August 29, 2023 09:00
Show Gist options
  • Star 32 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save nicebread/6920c8287d7bffb03007 to your computer and use it in GitHub Desktop.
Save nicebread/6920c8287d7bffb03007 to your computer and use it in GitHub Desktop.
These code snippets have been tested on R 3.1.0 and Mac OS 10.9.3. They presumably do *not* work on R 2.X!
## Enter these commands in the Mac OS Terminal
# use faster vecLib library
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib
# return to default settings
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf libRblas.0.dylib libRblas.dylib
# R script for benchmarking:
# http://r.research.att.com/benchmarks/R-benchmark-25.R
# On 2011 Macbook Pro (2.7 GHz Core i7): 43 sec. (Rblas) vs. 9 sec. (vecLib)
@ShawnWx2019
Copy link

After following the commands:

use faster vecLib library

cd /Library/Frameworks/R.framework/Resources/lib ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib libRblas.dylib

Rstudio in my macOS (Monterey, version 12.0.1) is not working. I got the following error:

This site can’t be reached 127.0.0.1 refused to connect. Try:

Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED Check your Internet connection Check any cables and reboot any routers, modems, or other network devices you may be using. Allow Chromium to access the network in your firewall or antivirus settings. If it is already listed as a program allowed to access the network, try removing it from the list and adding it again. If you use a proxy server… Check your proxy settings or contact your network administrator to make sure the proxy server is working. If you don't believe you should be using a proxy server: Go to Applications > System Preferences > Network > Advanced > Proxies and deselect any proxies that have been selected.

Could you please give your kind suggestions regarding this issue?

cuz macOS 12.0.1 has removed libBLAS.dylib from /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/

so another way to speed up matrix calculation in R is use openblas

so if Homebrew has been installed in your Mac, pls try:

brew tap homebrew/science
brew install openblas

then check the dir

cd /usr/local/opt/openblas/lib

if there is a libopenblas.dylib in this dir,

ln -sf /usr/local/opt/openblas/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib

sorry for my poor English...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment