How to get Mark run on a Mac with M processor
Jean-Pierre Vacher and Matthieu Boileau First version 9/29/2021
If you want to use Mark or Rmark on a Mac computer with an M chip, here’s the procedure. We first developped it on a M1 laptop from 2020.
Open a Terminal console from Rosetta (tick “open using rosetta” after clicking command+i on the Terminal icon from the Applications folder. The Terminal is in the Utilities subfolder). Architecture problem of the gfortran librairies, which are in arm64 on M1 chips and should be in x86_64 to run Mark. To check which architecture the dynamic libraries use, type and execute the following code in the Terminal:
cd /usr/local/lib/
file libgfortran.5.dylib
cd /usr/local/lib/
file libgfortran.3.dylib
Locate the correct directory:
cd /usr/local/bin/
otool -L ./mark
Check which version and where it is stored:
find /usr/local/ -name “libgfortran*”
find /usr/local/ -name “libgomp*”
find /usr/local/ -name “libquadmath*”
Charge an older version of gcc:
brew search gcc
Choose v.8 as it has a x86_64 architecture:
brew reinstall gcc@8
Create symbolic links:
cd /usr/local/lib/ #this command enables to be in the correct directory right away
sudo ln -s /usr/local//Cellar/gcc/11.1.0/lib/gcc/11 lib #we add lib if we are not in the correct directory, otherwise it’s not needed
sudo ln -s /usr/local//Cellar/gcc@5/5.5.0_6/lib/gcc/5
sudo ln -s /usr/local//Cellar/gcc@8/8.5.0/lib/gcc/8/libgfortran.5.dylib
sudo ln -s /usr/local//Cellar/gcc@10/10.3.0/lib/gcc/10/libgfortran.5.dylib
sudo ln -s /usr/local//Cellar/gcc@8/8.5.0/lib/gcc/8/libgomp.1.dylib
sudo ln -s /usr/local//Cellar/gcc@8/8.5.0/lib/gcc/8/libquadmath.0.dylib
sudo ln -s /usr/local//Cellar/gcc@8/8.5.0/lib/gcc/8/strataG.so
sudo ln -s /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/lib/server/libjvm.dylib
Delete a directory (delete symbolic link):
rm -rf
Check which architecture dynamic libraries use:
cd /usr/local/lib/
file libgfortran.5.dylib
cd /usr/local/lib/
file libgfortran.3.dylib
file libjvm.dylib
Now it should work!
Other stuff
gcc intel for rosetta. Reinstall gcc with rosetta:
sudo rm -rf /usr/local/gfortran /usr/local/bin/gfortran
sudo pkgutil –forget com.gnu.gfortran
brew reinstall gcc
Run Rjava on a M1 Mac with R v.4.1
Install java to run rJava on Big Sur with R 4.1.1 - go to https://www.oracle.com/index.html - click Product -> Software -> Java - click Download Java - select macOS - download Arm 64 DMG installer
Then install JDK17
And it should work!