Created
March 30, 2025 22:16
-
-
Save s-u/8785cac09b2c56ca2472676f300a9d3b to your computer and use it in GitHub Desktop.
Update R from last-success branch builds
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
#!/bin/bash | |
set -e | |
arch=$(uname -m) | |
if [ -z "$1" ]; then | |
echo '' | |
echo " Usage: $0 <version>" | |
echo '' | |
echo " Will fetch R-<version>-branch-$arch.tar.xz so use something like" | |
echo " $0 4.5" | |
echo "" | |
echo " Can also be 'devel' in which case it fetches R-devel" | |
exit 1 | |
fi | |
BV="$1" | |
if [ "$BV" = devel ]; then | |
fn="R-devel" | |
else | |
fn="R-$BV-branch" | |
fi | |
cd /Library/Frameworks/R.framework/Versions | |
echo "Fetching and unpacking ${fn}-${arch}.tar.xz ..." | |
curl -sS https://mac.r-project.org/big-sur/last-success/${fn}-${arch}.tar.xz | tar xj | |
ver=$(ls R.framework/Versions | grep ${arch}) | |
echo " - yields $ver" | |
rm -rf ${ver}-old | |
if [ -e ${ver} ]; then | |
echo " - remove ${ver}-old" | |
mv ${ver} ${ver}-old | |
fi | |
echo " - move new into $ver" | |
mv R.framework/Versions/$ver . && rm -rf R.framework | |
R_HOME=/Library/Frameworks/R.framework/Versions/$ver/Resources /Library/Frameworks/R.framework/Versions/$ver/Resources/bin/exec/R --version | head -n4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment