Last active
April 8, 2023 17:52
-
-
Save dereckmezquita/ed860601138a46cf591a1bdcc95db0a2 to your computer and use it in GitHub Desktop.
Makevars and instructions for installing installing data.table on an M1 Mac; note config also works for installing slam/syuzhet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # if you downloaded llvm manually above, replace with your chosen NEW_PATH/clang | |
| LLVM_LOC = /opt/homebrew/opt/llvm | |
| CC=$(LLVM_LOC)/bin/clang -fopenmp | |
| CXX=$(LLVM_LOC)/bin/clang++ -fopenmp | |
| # -O3 should be faster than -O2 (default) level optimisation .. | |
| CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe | |
| CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe | |
| LDFLAGS=-L/opt/homebrew/opt/gettext/lib -L$(LLVM_LOC)/lib -Wl,-rpath,$(LLVM_LOC)/lib | |
| CPPFLAGS=-I/opt/homebrew/opt/gettext/include -I$(LLVM_LOC)/include |
Author
Author
Versions
R --versionR version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.
brew --versionHomebrew 3.3.4
Homebrew/homebrew-core (git revision 9ba60a6af62; last commit 2021-11-17)
Homebrew/homebrew-cask (git revision 8f52edfbb5; last commit 2021-11-17)
RStudio
RStudio
2021.09.1 Build 372
© 2009-2021 RStudio, PBC
Author
RStudio troubleshooting
If you have trouble running RStudio, installed by one user launched from another user on the same machine. Your permissions and ownership might be broken. Try first to re-install RStudio. If this doesn't work the run:
sudo chown -R root RStudio.app
sudo chmod -R 0755 RStudio.appAs a note, this worked for me after being failed by the data.table instructions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Install multithreaded openMP
data.tableon anM1MacInstalling
data.tableon an M1 Mac with multithreading support can be frustrating. Here is the process I used to accomplish this.If you've come across an error something like, cannot link file wrong architecture it is likely you've experienced the same erroneous set up I had:
ld: warning: ignoring file /Library/Frameworks/R.framework/R, building for macOS-arm64 but attempting to link with file built for macOS-x86_64The solution, install an
armversion ofR(I had intel) the new version ofRStudiowhich supports thearmversion ofR, and then setup yourMakevarsso everything can compile toarm. What was happening before is you had anintelversion ofRinstalled and wanted to compile forarmwhich is incompatible when linking.Install
arm RInstall
Rby usingbrewthe package manager. The current version available is:For more detailed information on installing
data.tablevisit: data.table installation instructionsThis will install in the following directory:
/opt/homebrew/opt/r/Note if you want to have a multi-user set up for your
brewinstallations use this guide: github.com/dereckdemezquita/mac-setupInstall
llvmWe need
llvmto compiledata.table:Make sure the path is exported in your
.zshrc:Makevars
Now that you have
Rinstalled (should be the Apple silicon version; brew installs this one for you). You can create theMakevars. This is simply a file with the nameMakevars. This files holds the configurations necessary to compile packages on installation or withRcpp. You don't have to have this configuration active at all times, just for compilingdata.table.The location of this file is:
~/.R/MakevarsPaste the content shown in the gist.
Install
data.tableInstall
data.tablethrough an externalRconsole (terminal then type R). Note ifRin the terminal window doesn't work this is because you haven't exported the path toRexecutable to your console.library("data.table")