Introduction to Build-Select Script
This page will help you use menu-driven scripts to install the latest version of Loop (master or automatic-bolus branch), FreeAPS (fork) or Loop Follow. It also has options to assist with cleanup, Xcode updates and provisioning profiles.
What if your Xcode is too old for your phone iOS? The traditional wisdom is to follow the steps to update mac OS and Xcode version, but sometimes you cannot do that and you need to build Loop anyway.
Once you get to the Workspace build section later on this page, you’ll be able to follow this video provided by Jon Fawcett that enables you to build Loop anyway. (The link to the video is repeated on the workspace build instructions that automatically open when you run the script.)
What is a script?
A script is a series of commands that are meant to be issued to your Mac OS in the terminal window (on a mac or a virtual mac on a PC). The script issues the commands in order and checks status as it goes along. It does NOT mean you shouldn’t read the pages in Loopdocs on building or updating. It just makes your Loop build easier. (Note, the link to Loopdocs goes to the updating page.)
What will the script do?
First the script will warn you that this is a DIY system. You must acknowledge to continue.
Please read the options carefully:
- Build Loop
- Build Loop Follow
- Utility Scripts
Selection 1: Build Loop
If you type 1 for Build Loop and return, the script will ask which version of Loop you want to install. Once you make a selection, it will check that your system has required elements, download the latest version of code to a new download folder and help you install it.
If you don’t know which version you want after reading the information at Compare Versions or are confused about any of the steps – please stop and ask for help.
Please ensure that you have a compatible version of Xcode installed and your phone is plugged into your computer.
You may want to check out the Version Updates page (which has links to lots of other helpful pages) to make sure your phone, operating system and Xcode versions are compatible.
Loop Version Choices
- Master Branch
- Automatic Bolus Branch
The script will automatically
- Download from github the latest code for the version that you selected
- Start Xcode pointing to the newly downloaded code
- Open a page showing you how to do a Workspace build (it’s easy)
- If you have favorite customizations, enter them before hitting the build button
Note about carthage
Carthage is a package that, in the past, you had to manually install. You no longer need to install carthage to build Loop (master or automatic-bolus) or FreeAPS. The script offers an option to install carthage – you can say no, although saying yes does not harm and prevents your from seeing that question in future uses of the Build-Select script.
If you happen to have an incompatible version of carthage on your computer, check out LoopDocs Build Error Page. That link takes you straight to the error fix section for an incompatible version of carthage. If you need to post for help, go to the top of that page and follow the directions for how to fix most problems yourself and how to ask for help.
Selection 2: Build Loop Follow
If you type 2 for Build Loop Follow and return, then the script will download the latest version of Loop Follow code and install it. If you are not familiar with Loop Follow – please stop and ask for help in the Loop Follow Facebook group.
Selection 3: Utilities
If you type 3 for Utilities and return, then the script will offer some choices. PLEASE read carefully.
- Clean Carthage and Derived Data
- Xcode Cleanup (The Big One)
- Clean Profiles Carthage and Derived Data
Should You Delete Provisioning Profiles Before You Rebuild?
What’s a provisioning profile? It tells your phone that it’s OK to run this app – but it also has an expiration date. As soon as the expiration date is past – your app will not open! Please don’t be that person. Please follow the steps to delete provisioning profiles (from your computer) and rebuild Loop (to your phone with a year until expiration) at least once a year. And put that expiration date in your calendar – give yourself plenty of time. The less frequently you build, the more time you will need. A week is pushing it. A month is better.
If you don’t delete provisioning profiles, Xcode may reuse the ones on your phone and your Loop app would then expire when the old provisioning profile expires.
If you build frequently, you do not need to delete the profiles every time. There is a small chance that deleting the profiles will force a new certificate (you will be directed to revoke the certificate) – that will affect all apps built with your developer user ID (more details below). So you should decide when to delete the profiles – it is not an automatic step in the script.
To check your expiration date so you don’t get surprised, see expiration date.
For more information about provisioning profiles, see Loopdocs update steps 4a.
What does new certificate mean?
The certificate was assigned to your Apple Developers ID when you signed up at Apple Developer Account. Normally that certificate is yours for as long as you keep your account paid annually. The provisioning profiles are based off your certificate, and last only one year.
So far, a few people have reported that deleting the provisioning profiles forced them to get a new certificate from Apple, which means the old certificate is no longer available. Any app built on any phone that used that certificate will expire, probably within 24 hours. That means backup phone, kids phones, friends you helped by building Loop for them (remember that it NOT recommended), etc. Make sure you know every device that uses your certificate and keep a list so you can contact them if you have to revoke your certificate.
New Provisioning Profile, New Cert
You are still you. Your Apple Developer ID has not changed. You can still build a new Loop on your phone over the old one and have all your settings, pump and CGM keep working. Although we do recommend you check the settings after a build – just in case.
For experts – (last updated March 17, 2021) if you have been using the dev branch and switch back to one of these three Loop versions – you probably want to start with a new app on your phone. You can use dev if you’d like, but the round trip has been an issue for some – not recommended. You cannot build dev using the Build-Select script.
For everyone else, all the versions in this script are compatible – you can switch between any of these versions: Loop (master or automatic-bolus branch) or FreeAPS (fork) and back. The new app will build over the old app on your phone and all standard Loop settings should transfer.
Carefully read what is on the screen before making any choices.
Step 1: Open Terminal.
Tip: press command-space to open spotlight search. Start typing term… and you will see the Terminal application icon in the box. Hit enter to open.
Step 2: Copy/Paste this code into the Terminal:
/bin/bash -c "$(curl -fsSL https://git.io/JImiE)"
Step 3: Hit Enter, then carefully choose from the options listed
When done, you can repeat the script and select a new option by simply hitting up arrow on the keyboard while in the terminal and hit return when you see the command appear.
For example, you could start with Utility Scripts and choose the desired option, then when that’s done, up-arrow and select Build Loop.
History (if you’re interested)
First there was a set of separate scripts that each did a separate task.
Then the authors made a front-end script so you can select which task you want to do by running the BuildLoop.sh script one or more times.
The scripts are open source – you can make a pull request or post an issue at https://github.com/loopnlearn/loopbuildscripts