Last active
January 29, 2026 15:17
-
-
Save wch/111f25572145d095399df31336f4de8e to your computer and use it in GitHub Desktop.
Script for updating to latest RStudio daily build
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 | |
| # | |
| # Installs the latest RStudio daily desktop build for OSX/macOS and Ubuntu(amd64) | |
| # | |
| # https://support.rstudio.com/hc/en-us/articles/203842428-Getting-the-newest-RStudio-builds | |
| set -e | |
| install_macos_daily() { | |
| INDEX_URL="https://dailies.rstudio.com/rstudio/latest/index.json" | |
| echo "Fetching daily build info from: ${INDEX_URL}" | |
| # Fetch the JSON and extract the macOS desktop download URL | |
| RELEASE_URL=$(curl -s "${INDEX_URL}" | jq -r '.products.electron.platforms.macos.link') | |
| if [ "${RELEASE_URL}" == "" ] || [ "${RELEASE_URL}" == "null" ]; then | |
| echo "Could not extract daily build URL from JSON; maybe dailies.rstudio.com is having problems?" | |
| echo "Check: ${INDEX_URL}" | |
| exit 1 | |
| fi | |
| echo "Downloading daily build from: ${RELEASE_URL}" | |
| cd /tmp | |
| TARGET=$(basename "${RELEASE_URL}") | |
| # Volume name mirrors the DMG filename without extension. | |
| # Simpler than parsing hdiutil output. | |
| VOLUME_NAME=$(basename "${TARGET}" .dmg) | |
| VOLUME_MOUNT="/Volumes/${VOLUME_NAME}" | |
| curl -L -o "${TARGET}" "${RELEASE_URL}" | |
| hdiutil attach -quiet "${TARGET}" | |
| # Remove any prior installation. | |
| rm -rf /Applications/RStudio.app | |
| cp -R "${VOLUME_MOUNT}/RStudio.app" /Applications | |
| hdiutil detach -quiet "${VOLUME_MOUNT}" | |
| rm "${TARGET}" | |
| echo "Installed ${VOLUME_NAME} to /Applications" | |
| } | |
| install_ubuntu_daily() { | |
| INDEX_URL="https://dailies.rstudio.com/rstudio/latest/index.json" | |
| echo "Fetching daily build info from: ${INDEX_URL}" | |
| # Fetch the JSON and extract the Ubuntu desktop download URL (jammy/22.04) | |
| URL=$(curl -s "${INDEX_URL}" | jq -r '.products.electron.platforms.jammy.link') | |
| if [ "${URL}" == "" ] || [ "${URL}" == "null" ]; then | |
| echo "Could not extract daily build URL from JSON; maybe dailies.rstudio.com is having problems?" | |
| echo "Check: ${INDEX_URL}" | |
| exit 1 | |
| fi | |
| PACKAGE=$(basename "${URL}") | |
| TARGET="/tmp/${PACKAGE}" | |
| # If previous file exists (from previous partial download, for example), | |
| # remove it. | |
| if [[ -f "${TARGET}" ]]; then | |
| echo -e "Removing existing package file: ${TARGET}" | |
| rm "${TARGET}" | |
| fi | |
| echo "Downloading daily build from: ${URL}" | |
| if [ -x /usr/bin/curl ] ; then | |
| curl -L -o "${TARGET}" "${URL}" | |
| elif [ -x /usr/bin/wget ] ; then | |
| wget -O "${TARGET}" "${URL}" | |
| else | |
| echo "Unable to obtain the RStudio package: cannot find 'curl' or 'wget'" | |
| exit 1 | |
| fi | |
| echo "Installing ${TARGET}" | |
| LAUNCH="" | |
| if [[ `whoami` != "root" ]]; then | |
| LAUNCH="sudo" | |
| fi | |
| ${LAUNCH} dpkg -i "${TARGET}" | |
| rm "${TARGET}" | |
| } | |
| if [[ `uname -s` = "Darwin" ]]; then | |
| install_macos_daily | |
| elif cat /etc/issue | grep -q Ubuntu ; then | |
| install_ubuntu_daily | |
| else | |
| echo "This script only works on OSX/macOS and Ubuntu Linux." | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment