Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:26
Show Gist options
  • Save hrbrmstr/15375ec7a873d17ea5e2 to your computer and use it in GitHub Desktop.
Save hrbrmstr/15375ec7a873d17ea5e2 to your computer and use it in GitHub Desktop.
A small script to grab the latest RStudio daily build for OS X and install it.

I like to run the RStudio dailies since Kevin Ushey is always adding good stuff (and it's super-easy to use a stable version if the daily is wobbly).

Rename rsupd.bash to just rsupd (I wanted it to render nicely in the gist so I had to put an extension on it) then put the rsupd script into /usr/local/bin and (from a command prompt) do chmod 755 /usr/local/bin/rsupd

Now, copy the is.rud.UpdateRStudio.plist to ~/Library/LaunchAgents if you want the update to happen automatically. Change the hour/minute if 0730 AM doesn't work for you for some reason. Then use: launchctl load -w ~/Library/LaunchAgents/is.rud.UpdateRStudio.plist to load it (use unload vs load to, well, unload it).

If you want to run it by hand, just enter rsupd as a command prompt.

As stated in the rsupd.bash script, it requires external utilities, so read the comments and ensure you've done that, otherwise the script won't work!


  • Added instructions for loading job with launchctl
  • Fixed issue in vol=${atch##* }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
# this script relies on the W3C HTML XML tools and the "trash" utility
# the easiest way to install them is to install homebrew
# then:
# brew install html-xml-utils trash
# Get URL for "latest" RStudio daily
url=`curl --silent "${rstudio_osx_daily_url}" | hxselect "tr#row0 > td > a" | sed -e 's/<a /<a /g' | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d'`
# Get just the name of the dmg file
fil=`basename ${url}`
# Download the daily dmg
cd /tmp
rm RStudio*dmg
curl --silent --output "${fil}" "${url}"
# Mount it
atch=`hdiutil attach ${fil}`
# Get the mount location
vol=${atch##* }
# Get rid of the old RStudio app
trash /Applications/
# Put the new one in /Applications
ditto ${vol}/ /Applications/
# Unmount the dmg
umount ${vol}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment