Build-Select Script for Loop with Patches

Loop and Learn has created a customized branch of Loop 3 (main_lnl_patches) that enables people who want the CustomTypeOne LoopPatches and additional CGM Clients (which support some Libre sensors) to use a special fork. Select the Loop with Patches option in the Build Select Script.

These instructions will enable you to build this customized version of Loop 3.  While our “secret” mission is to encourage FreeAPS users to migrate to Loop 3, we believe that many in the community will appreciate a customized Loop 3 app with these popular features.

Despite our encouragement to move to Loop 3, if you’re still interested in FreeAPS, check out the new FreeAPS Build Script.  FreeAPS has been removed from the Build Select Script.

On 20 March 2023, Loop 3.2.1 minor update was released.

Later that same day, Loop with Patches was also updated to 3.2.1 with LnL Customizations.

LnL Customizations

The customizations added in the main_lnl_branch are:

Read more about these customizations.

    Build-Select-Script Instructions

    You use the same script as before but now the building instructions are super easy – no more complicated signing or multi-numbered steps on a single graphic. Just wait for Xcode to finish resolving and downloading packages, and hit the build button.

    Read the instructions embedded in the Build-Select script and enjoy the ease of building Loop or Loop with Patches.

    This page will help you use menu-driven scripts to install the latest released version of Loop, Loop with Patches, or Loop Follow. It also has utility options to assist with cleanup, Xcode updates, and provisioning profiles.  If you follow these instructions carefully, your Loop app should last one full year, however, we recommend that you build 3 to 4 times per year in order to keep your app up to date and to become more comfortable with the build process.

    • Before you start, take some time to make sure that you’re ready for your build:
      • Do you have a charging cable to connect your mac to your iPhone?
      • Have you checked Version Updates to make sure that your versions of iOS, Xcode, and macOS are compatible?  Loop 3 requires a minimum of iOS 15.1 and Xcode 14, but Xcode 14.1 is preferred.
      • Do you need to sign an updated Apple Developer agreement or update your credit card information?
    • If you don’t have a Mac or your Mac is too old to update to Monterey (which is required for iOS 15.4 and higher, and for Xcode 14.x), consider a Browser Build, which can be done from an older mac, a PC, a tablet, or even a phone (you’ll need very good eyes to be able to do this from a phone).  The two disadvantages of a Browser Build are that it needs to be rebuilt every 90 days (the rebuild process is fast), and it’s not easy to customize.   As of January 2023, other than the use of the loopnlearn GitHub fork of LoopWorkspace,  there is no easy way to customize your Loop app.
    • If you’ve used this page before and don’t need the instructions, you can skip ahead to Script Instructions.

    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 the status as it goes along. It just makes your Loop build easier. For more in-depth knowledge, read the pages on building (Loopdocs: Building) or updating (Loopdocs: Updating).  (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:

    1. Build Loop
    2. Build Loop Follow
    3. Utility Scripts
    4. Cancel

    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 the 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 here or are confused about any of the steps – please STOP and ask for help.

    Loop Version Options

    1. Loop
    2. Loop with Patches

    Type either 1 or 2 depending upon which version of Loop you’d like to build, and then click return.

    The script will automatically

    • Download the latest code for the version that you selected
    • Open Apple Developer so that you can copy and paste your Developer ID into terminal
    • Open a browser showing instructions for when you see the Initial Xcode Screens
    • Start Xcode pointing to the newly downloaded code
    • Optional:
      • Best practice is to build to a simulator to confirm all was correct with the download
      • If you have favorite customizations, add them and build to the simulator again
      • Finally, install it on your “real” phone

    If you get an error while building Loop, head on over to the LoopDocs Build Error page.  If you need to Ask for Build Help, be sure to provide all of the details that volunteer troubleshooters will need.

    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, there is information at the Loop Follow ReadMe. You can also join and ask for help in the Custom Type One Facebook group. You might be able to install Loop Follow from TestFlight – find out in the Facebook group.

    Selection 3: Utilities

    If you type 3 for Utilities and return, then the script will offer some choices.  PLEASE read carefully.

    1. Clean Derived Data
    2. Xcode Cleanup (The Big One)
    3. Clean Profiles

    Option 3 is recommended for each time that you build.   It resets the provisioning profiles so you get a full year from the date of the build.  However, we recommend that you build 3 to 4 times per year in order to keep your app up to date and to become more comfortable with the build process.

    If you’ve run these utility scripts in the hope of cleaning up unused and unneeded files and you still need more space, check out Xcode Cleanup.

    If you are doing updates or customizations to an existing download, you might want to use the Clean Derived Data utility option.

    Run the Script

    Carefully read each of the Steps below before making any choices.

    Step 1: Open Terminal.

    Tip: press command-space to open spotlight search. Start typing “term” (without the quotes) and you will see the Terminal application icon in the box. Hit enter to open.

    Step 2: Copy/Paste the line below into the Terminal (be sure to copy the entire thing starting at the first /bin/bash and ending with )”

    /bin/bash -c "$(curl -fsSL"

    Step 3: Hit Return, then select Utility Scripts and choose Option 3 so that your Loop app will last a full year.

    Step 4: When done, run the script in terminal again by pressing the up arrow on your keyboard

    Step 5:  Hit Return to run the script a second time and select Option 1:  Build Loop.

    When your Loop code is finished downloading, there are now a lot of detailed messages in the LoopnLearn build-select script, read along as you go. It tells you when to look for errors, when to hit return, when to plug in your phone, and then opens:

      • Browser pointing to LoopDocs to assist in building the code
      • Xcode in the fresh download directory 

    If you get an error message while downloading your Loop code, head on over to Loopdocs.

    Skip to content