Helping a Good Cause with Folding@Home

It’s been a while since I have published something or been apart of the Apple community. For my first personal blog in a while, I thought it might be good to write about where a good cause and technology overlap.

As the world tries to contain the spread of COVID-19, it’s easy to feel like you’re on an island and unsure how to help others. You can practice social distancing or even stay at home as much as possible, but what if you want to do more? Some folks have helped local food banks, donated blood, dusted off the old sewing machine to make face masks, or even fired up their 3D printers to make face shields for medical workers.

As a big nerd, I am always looking for a technology solution to a social problem! While I spent years talking with schools about doing the exact opposite, there are things that technology can help with. Folding@Home has been around since the late 2000s and simulates proteins to gather insights on diseases like COVID-19, Breast Cancer, Ebola, and Alzheimers. Greg Bowman, Ph.D. at Washington University School of Medicine in St. Louis explains this far better than I ever could on YouTube. The big take away is the more we understand these diseases, the better chance we have at discovering possible treatments in the future.

So what does this have to do with Apple device management? Well, Folding@Home is powered by tons of computers linked together in a distributed computing network. And what do Apple admins have lots of? Hundreds upon thousands of computers that can be put to work! On top of it, macOS is in last place in their leaderboard so we gotta change that people! So you might be thinking,

“Ok, you have my interest peeked with the whole disease mapping hive mind thingy… but what does this do to my computers and end users? Will they be impacted doing their daily work? Will it hurt my computers?”

The quick answer is you can configure Folding@Home to not impact users or the life of your hardware. There are tons of ways to configure the Folding@Home client and we will be assuming that we are talking about end-user devices from here on out. Things that will be taken into consideration are active computer usage, device battery power, and the amount of stress to the hardware. If you have some hardware sitting in a closet, feel free to drag it out and change a few settings to let that thing go full throttle for as long as you want too! With a few minor tweaks, you can have old server hardware or dusty computers doing some work as well.

What we will be doing in this tutorial will be the following:

  • Uploading Folding@Home to Addigy
  • Configuring installation, conditions, and removal
  • Deploying to clients with GoLive and Policies
  • Reviewing the end-user experience

Uploading Folding@Home to Addigy

To start our journey, head over to the Folding@Home’s Start folding page and download the latest installer file. At the time of writing, the current version is 7.5.1. This will be important when we get to the installation script section. Once it downloads, make sure to unzip it and then head over to your Addigy Administrator Console. Log in into your Addigy organization and navigate to Policies and then to Catalog. We will be using Smart Software under the Custom Software tab to upload and configure our install.

Smart software pane within Addigy

Next, click on the Add Software button and fill in Folding@Home and the version that was downloaded. Here is where the magic starts to happen! Go ahead and upload the .mpkg file that was downloaded earlier. As a quick aside, Smart Software automatically reviews files you upload for any apps that are inside to make it easier to make Privacy Preference Policy Control (PPPC) Profiles. For this app, we will not need to add any PPPC Profiles as the app does not need access to user data or hardware like the microphone.

Alright back to finishing up creating this software item! The next few fields are Description, Category, and Icon. While these are optional, they are a nice quality of life thing to do for yourself and your end-users. Feel free to configure as you see fit. If you decide to publish this software to your Self Service app, it is usually a good idea to upload an icon and add a category. Below is a .png file from the Folding@Home app for you to use.

Folding@Home Icon

Configuring Installation, Conditions, and Removal

Before diving head-first into building the Installation Script, I highly recommend heading over to the Get a Passkey section of Folding@Home. This webpage will ask you for a (user)name and email address so they can send you a passkey to your email. This account can be used to track completed work units and your points for completed tasks. Think of these as Schrute Bucks or Monopoly money for digital bragging rights. You can also use this username and passkey combination on as many computers as you like. I also have created an Addigy Community team where we can digitally crush numbers together and move up the leaderboards.

Installation Script

Time for the fun part! Scripting! I have taken care of all the heavy lifting below for folks newer to the command line. As always, I would strongly encourage you to read the script prior to dropping it into Addigy. It’s always good to know what will happen and what you are adding to your organization. With Smart Software, you can generate a default installation script via the Add button up in the Installation Files section. However, since we will be adding some additional configuration to enable idle when a user being present or being on battery, I’ve added the modified script is below. You will find comments within the code so even those who haven’t scripted before can see what is going on. Again, please ensure that you modify the Username and Passkey so you can get those digital bragging rights!

# Make sure to grab a username and passkey from
# Variables to configure
Username="AddigyUser" # Modify with your username
Passkey="SomePasswordToChange" # Modify with your passkey
Team="259574" # Addigy Community Team ID
# Nothing else needs to be changed below this line 🙂
# Installing pkg file (generated via the Add button)
/usr/sbin/installer -pkg "/Library/Addigy/ansible/packages/Folding at Home (7.5.1)/fah-installer_7.5.1_x86_64.pkg" -target /
# Configuring fahclient
# The commands below here send updated configuration settings to Folding@Home
# Note: pausing on battery power is a default behavior
# We are setting the data crunching power to light which will only use up to 50%
# of the CPU. This can be cranked up to medium or full for computers which you
# want to use more CPU resouces for. Adding the user, passkey, and team to the
# config for earning points and bragging rights.
/usr/local/bin/fahclient –send-command "options power=light user=$Username passkey=$Passkey team=$Team"
# Enabling the feature within the client to only run at idle.
/usr/local/bin/fahclient –send-command "slot-options 0 idle=true"
# Saving the configurations above to the config.xml file in /Library/Applicaiton Support/FAHClient
/usr/local/bin/fahclient –send-command save
# Exiting Script
exit 0

view raw
hosted with ❤ by GitHub

Condition Script

Now that the installation script is completed, we need to add a Condition Script to verify Folding@Home isn’t installed. Instead of pasting some long-winded script, we can simply use the Smart Software Condition Script wizard to make our lives super easy! For this step, we are going to scroll down to Conditions and open the carrot for Check for an application version. When that section drops down, you will need to select the following options:

  • Set the first drop down to Failure
  • Add to the first text box Folding@home/FAHControl so that the whole line reads: /Applications/Folding@home/
  • Set has version dropdown to newer or same as
  • Add to the version text box 7.5.1 or whichever version you’ve uploaded to Addigy

Condition Script in AddigyOnce you have done all of that, click Add to script and Addigy will spit out a bunch of code that will make worrying about all the complex logic disappear! Just underneath the auto-generated condition script, you should also see that the Install on success toggle has been flipped on and is set to Finished. You can leave both of these as-is.

Removal Script

Last but not least, it is usually a good idea to consider adding a Removal Script to a piece of software. This can be super handy when deploying software that you might want to remove later. Please note that when removing a software title from a Policy, the removal script will be kicked off! If you don’t want that to happen, feel free to skip this part.

# This script has been largely taken from Folding@Home's default removal script
# with modifications being only in shortening as we care less about prior names
# of items. We have added in an additional step in removing the config folder
# terminate FAHControl and FAHViewer if running
/usr/bin/killall -TERM FAHControl FAHViewer
# stop folding service
if [ -f "$LaunchDaemon" ]; then
/bin/launchctl unload -w "$LaunchDaemon"
rm -f "$LaunchDaemon"
# try to unload job, even if user manually deleted plist
/bin/launchctl remove org.foldingathome.fahclient
# kill any FAHClient still running
if /bin/ps auxwww | grep "FAHClient" | grep -v 'grep'; then
/bin/sleep 5
/usr/bin/killall -TERM FAHClient
# remove scripts, symlinks, executables
/bin/rm -f /usr/local/bin/FAH{Client,CoreWrapper}
# remove config files
/bin/rm -rf "/Library/Application Support/FAHClient"
# remove apps
/bin/rm -rf "/Applications/Folding@home"
exit 0

view raw
hosted with ❤ by GitHub

Once you have the removal script copied and pasted into the input box, go ahead and Review Changes and Confirm Changes. With that, you are done configuring the software and can go ahead with the next phase, deployment!

Deploying to Clients with GoLive and Policies

With Addigy, there are several ways you can send out software. If you want to test this newly minted software title on a device or two, GoLive would make an excellent option. Just go to Devices, find the device you want and click GoLive. Once there navigate to Deployments and select Custom Software. There you can find Folding@Home and you can click the Deploy button to send the software to the device. Piece of cake!

Deploying Folding@Home with GoLiveAnother option for easy deployment would be Self Service. With Self Service, you can allow your end-users to decide if they want to participate in this science experiment and donate some CPU cycles after work. Advertising software in Self Service is as easy as a toggle. Before getting started, ensure that you have Self Service configured for your Policy. You can read more about Creating a Self Service Configuration on our KB. Once a Self Service Configuration has been created and deployed, we can now move onto adding software to Self Service. Go to Policies, choose a policy for deployment, and then Software. Under Your Software, you will see every title you have uploaded and you can simply toggle the Self Service switch to make it available for anyone to install within that Policy. #sosimple

Deploying Folding@Home with Self ServiceLast but not least, if you wish for every device within that Policy to receive this software title, simply choose Add App instead of the Self Service toggle. This will queue the app for Deployment. To accept these changes, navigate to Deploy Changes and accept the updates to the Policy. Once a device checks back with Addigy, Folding@Home will install and be ready to go.

Reviewing the End User Experience

When Folding@Home is configured and deployed to your devices, the app can be in three possible states: Paused: waiting for idle, Paused: on battery, or Running. This can be reviewed by running the FAHControl app, opening a web browser on the client to, or checking the log.txt at /Library/Application Support/FAHClient. The screenshot below is what the FAHControl app looks like while it’s waiting for me to finish work for the day so it can start crunching some numbers.

Folding@Home Control Running

In my experience the waiting for idle typically takes about 5-15 min and usually runs when my screensaver starts. The battery power detection and pausing is pretty close to instant from several tests I have run. Finally, when the process is running on my MacBook Pro, the fans will kick up a bit but not loud enough to scare my dogs.

To wrap it all up, we have done a lot of work in a short amount of time. We bundled up the Folding@Home app and its configuration. We reviewed various deployment methods with Addigy and wrapped it all up looking at the end-user experience. In the end, we hope that this post was educational about the functionality that Addigy provides and offers all of you an outlet to help our research universities better understand the complex diseases of our time. Thank you for taking the time and please take care and be safe!

P.s. Please join the Addigy Community Team when you start folding so we can move up those leaderboards together!

Site Updates

Hello (Again) World

It’s been a while since I last posted anything to my blog. So much so that I decided to start clean. Over the next few days, I’ll try to post a few more things and do some major renovations. I gotta work out the kinks with WordPress, get plugins installed, and figure out my theme :).

With more time at home than I have had in a very long time, I figured it might be good to start writing again. Get back into the community of Apple professionals! Start writing scripts and sharing on GitHub. And of course, the occasional post about video games.

I hope to stick with this a bit more this time. My goal is to publish at least one post per week. My focus will be on technology… usually Apple related, and hopefully will be of medium length. Not like this short post today.

I hope you all are staying safe and healthy and look forward to sharing my thoughts and crazy ideas with you all in the future!