Build Select Script Overview

This page provides documentation for the Build Select Script. This script is continually updated with new features that automates more steps to simplify the process.

The options provided by the Build Select Script are:

  1. Build Loop
  2. Build Related Apps
  3. Maintenance Utilities
  4. Customization Select
  5. Exit the Script

The script menu:

  • Makes it easier to sign and build your Loop app
  • Makes it easier to build Loop related apps
  • Includes Maintenance Utilities to clear disk space on Mac, including removing old downloads
  • Includes Customization Select to add or remove Loop customizations
  • Repeats so you can perform multiple actions
  • Is hosted at https://github.com/loopandlearn/lnl-scripts/

Before using the script to build an app, review the requirements for that app.

  • If you are building or updating Loop, have you checked Version Updates to make sure that your versions of iOS, Xcode, and macOS are compatible?
  • If you need to clear disk space prior to updating your Mac, use the Maintenance Utility options
  • Do you need to sign an updated Apple Developer agreement or update your credit card information?
  • Do you have a charging cable to connect your Mac to your iPhone?
  • For more documentation on steps you need to take before updating Loop, follow this link to LoopDocs: Updating

If you don’t have a Mac or your Mac is too old to update to the required versions for your phone iOS, consider LoopDocs: Browser Build, which can be done from an older mac, a PC or a tablet.

A script is a series of commands that are meant to be issued to your Mac 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 makes your app download and build easier. For more in-depth documentation, including step-by-step graphics, please see: LoopDocs: Mac-Xcode Build.

The script provides a menu for you to select your desired option, and then guides you through the steps for each option. When that option has been completed, you are returned to the top-level menu to select another option or exit the script.

It is a good idea to review this entire page before starting the script. Please read the messages as you proceed.

Run the Script

Carefully read the information in the terminal 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 the entire line starting with /bin/bash and then Paste the line into the Terminal and enter

Click on the line below to copy it. You’ll see Copied to Clipboard briefly.

Step 3: Choose from one of the options

  1. Build Loop
  2. Build Related Apps
  3. Maintenance Utilities
  4. Customization Select
  5. Exit the Script

Many of these options offer several choices. If you change your mind after selecting an option, you can choose “Return to Menu” to get back to the top-level menu shown above.

If you choose an option that involves downloading and building an app

  • You will be required to acknowledge a warning
  • There are automated checks that Xcode is installed
  • The script reports the version of Xcode you have installed and what iOS it can support
  • You should choose `Ensure a Year` when offered, that means the app on your device will last for one year from the build date,  but we strongly recommend that you build when bug fixes and feature enhancements are added, which typically happens 3-4 times per year.

Selection 1: Download and Build Loop

If you type 1 for Download and Build Loop and return, the script will give you the option to build Loop main 3.4

  1. Loop main 
  2. Return to Menu

Type either 1 or 2 to continue, and then click return. A 3 returns to the top-level menu.

    The script will automatically

    • Download the latest code for the version that you selected
    • Make sure your Xcode path is set correctly
    • Check the status for automatic signing and walk you through the steps to configure it if needed
    • Ask if you want to ensure a year (you should say yes)
    • Start Xcode pointing to the newly downloaded code already signed and ready to build Loop using LoopWorkspace
    • Best practice is to build to a Simulator or other phone (not your Looping phone) to confirm all was correct with the download and then build to the Looping phone

    Xcode will automatically download some “packages” from the internet so you can build Loop. If you hit the Build button too soon, there’s a nice new warning message.

    • Build operations are disabled: Package loading in progress.
    • Click on OK and wait until you see the word indexing in upper right, then try again

    Optional:

    The Build Select Script returns to the main menu so you can select another option. You can choose to Run Customization Select or to build another related app, like LoopCaregiver or Loop Follow, without exiting the Build Select Script.

    • Select your customizations (if desired) and build to the simulator or other phone again (see Run Customization Select)
    • Finally, install the app on your “real” phone
    • If you plan to build to a simulator or create an archive file as a remote backup (LoopDocs: TestFlight from Xcode), then skip plugging in the phone

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

      Please always use screen shots from your Mac when asking for help. Photos taken from your phone are inadequate.

      • Command-Shift-3 and click for the full screen
      • Command-Shift-4 then space bar and click for the full Xcode window

      Selection 2: Download and Build Related Apps

      If you type 2 for Download and Build Related Apps and return, you will be given the choice of several apps related to using Loop. The build process follows the same pattern as the build process for Loop and includes automatic signing of the app. If you make a selection and then decide not to build that app, you can select “Return to Menu”; that takes you all the way up to the top-level menu.

      Loop Follow is an app that combines display information and alerts into a single easy-to-use interface. Loop Follow can get its data from Dexcom Share or Nightscout. There is more information at LnL: Loop Follow.

      If you select Build Loop Follow, the script will download the latest version of Loop Follow code and install it. You are offered a choice to build one of two branches, main or dev. Most people should choose the main branch.

      If you follow more than one Looper, you can build distinct apps (one for each person) for up to three Loopers. (If you need more than three, our sympathy and please reach to ask for help).

      LoopCaregiver is an app that enables a caregiver to monitor a Looper and provide remote commands to a Looper’s phone over wireless or cellular networks. There is documentation at LoopDocs: LoopCaregiver.

      If you select Build LoopCaregiver, the script will download the latest version of LoopCaregiver code and install it. You will be warned that this app is under development and be asked to review some links prior to using it.

      Build xDrip4iOS (CGM App)

      xDrip4iOS is an app that can read a variety of CGM devices, including some Libre sensors. If you build xDrip4iOS with the same developer ID as Loop and customize your app, you can use xDrip4iOS as the source of glucose for Loop. If you must use a version of xDrip4iOS not built with the same developer ID, then you will have to use Nightscout as a CGM with Loop and maintain consistent connection with the network.

      • Do not allow xDrip4iOS to write to Health if you are using Nightscout as a CGM
      • Do not allow xDrip4iOS to write to Health if you are using a Libre sensor that reports at 1-minute intervals
      • Make sure to limit Libre sensors to report to Loop only once every 5 minutes (Loop reads from Health)

      Glucose Direct is an app that can read a variety of CGM devices, including some Libre sensors. If you build Glucose Direct with the same developer ID as Loop and customize your app, you can use Glucose Direct as the source of glucose for Loop. If you must use a version of Glucose Direct not built with the same developer ID, then you will have to use Nightscout as a CGM with Loop and maintain consistent connection with the network.

      • Do not allow Glucose Direct to write to Health if you are using Nightscout as a CGM
      • Do not allow Glucose Direct to write to Health if you are using a Libre sensor that reports at 1-minute intervals
      • Make sure to limit Libre sensors to report to Loop only once every 5 minutes (Loop reads from Health)

      Selection 3: Run Maintenance Utilities

      If you type 3 for Run Maintenance Utilities and return, then the script will offer some choices to help with maintenance tasks. Please close Xcode first.

      1. Delete Old Downloads
      2. Clean Derived Data 
      3. Xcode Cleanup (The Big One)
      4. Clean Profiles
      5. Return to Menu

      Why do these exist?

      1. Each download can be up to 1 GB in size and you do not need to keep old versions around. This utility keeps the most recent download on your disk and asks you explicitly if you want to delete older versions it finds.
      2. Xcode derives a lot of data when it does a build. By deleting derived data, you clean up a lot of space. Be warned, it will slow down your next build when Xcode regenerates the derived data – but it only does that for the one app you are building.
      3. If you need more space in order to update to a newer version of Xcode, sometimes the best approach is to delete Xcode (and empty the trash) and then run `Xcode Cleanup`. Reboot your computer and then install the new version of Xcode.
      4. Clean Profiles is offered when you use the Build Select Script to download and build the most recent version. But if you know (for sure) that the version has not updated, you might choose to rebuild with the code already on your Mac. You can choose to issue the stand alone command listed below, or use Build Select Script and Run Maintenance Utilitiles to do the job for you.

      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 Need Even More Space on Xcode Cleanup page.

      If you are doing updates or customizations to an existing download and Xcode is giving errors, you might want to quit Xcode, use the `Clean Derived Data` utility option and try again.

      Several of the utilities listed above only issue a single command that you can issue in your terminal without running the script.

      To Clean Derived Data (first quit Xcode):

      To Clean Profiles:

      Selection 4: Run Customization Select

      If you type 4 for Run Customization Select and return, the Loop Customization Select Script will execute. Follow the link for information about this script.

      When you have completed adding or removing any customizations desired, you can return to the Build Select Script menu.

      
      

      All Scripts

      Most people won’t need this information, but is included here for completeness.  There are several scripts available for building apps not included in the Build Select Script. This includes Loop dev and Trio

      To find instructions for building those apps using a script, follow the link to the README page for the lnl-scripts repository. Each app not included in the Build Select Script menu has a copy/paste section for easy use.

      Skip to content