New CGM and Pump: Customize your Loop app
Customizations are the way to create your own personalized Loop app. Before you start to customize your Loop, you must successfully build Loop.
This page explains how to customize your Loop app to add a new CGM Client and new Pump that are not included in the released version of Loop. To learn more about customizing your Loop app, use the links above.
The process is similar regardless of which customization you choose. You’re going to be copying the customization code and then pasting it into terminal (for a Mac-Xcode build) or into your build_loop.yml file (for a Browser Build) and then building Loop.
Browser Build
To customize with the Browser Build method, you need to modify your build instruction file, also known as your build_loop.yml file using these steps:
- Locate the Paste Line (in build_loop.yml file)
- Copy (from the appropriate template)
- Paste (in build_loop.yml file)
- Edit (for Dana pump only, in build_loop.yml file)
- Save or Cancel (in build_loop.yml file)
- Build Loop
- Troubleshoot (if necessary)
- Update
Locate the Paste Line
- Log into GitHub. If you do not log in, you will see in the upper right corner.
- Navigate to this link and substitute your GitHub username for username:
- There is a pencil on the right side – tap on the pencil and now you can edit the file
- Refer to the graphic below
- You need to find the line that starts with “# Patch Fastlane” (you will paste the template above this line)
- Use command-f (on a Mac) or control-f (on a PC), to find this phrase (use copy button below) and then command-v (on a Mac) or control-v (on a PC) to paste it into the search bar
- There is a blank line just above “# Patch Fastlane Match to not print tables”. We’ll call this row your Paste Line
- As of 21 July 2024, the Paste Line is on 279 for Loop-main, but is subject to change
Copy
WARNING – the template only works from the original language version – do not copy and paste from a translated page.
How to Copy:
- Click on one of the lines in the template below to copy the entire template to your paste buffer
- The words “Copied to Clipboard” will appear briefly
Paste
- Use the space bar to make sure that your cursor lines up in the correct column on the Paste Line
- Paste (using either command or control-v, depending upon whether you’re using a Mac or PC) the copied content into your build_loop.yml file at the Paste Line
- After pasting, hit return to insert another blank line
Edit – For Dana pump only
To upgrade the requested cloud computer to run macOS 15 (instead of 14) and Xcode 16.2 (instead of 15.4).
- Find the line (189) that says “runs-on: macos-14” (without the quotes) and change the 14 to a 15
- Find the line (201) that contains “Xcode_15.4.app” (without the quotes) and change the 15.4 to 16.2
Save or Cancel
When pasting is complete, you can either Commit (save) your changes or Cancel them
- To save your changes, tap the Commit Changes button on the upper right and commit to your current branch
- Once you commit your changes, you can make additional changes and modify the file again and save it with a new commit
- Each commit is recorded in your history, so including a comment about what you meant to do with each commit is a good idea
- Edit and save as often as needed
- To cancel your changes, tap the Cancel Changes button in the upper right corner
- You will be asked to confirm that you want to discard your unsaved changes
- Optional
-
- Edit the Commit message to be more specific; default is Update build_loop.yml
- Tap on Commit Changes at the bottom right to save to your main branch
Build Loop
- When you are happy with the changes to your build_loop.yml, hit Action> Build Loop
- Assuming there are no build errors, your new build will be ready in TestFlight in about an hour
- If your build fails after customizing, check out the Troubleshooting tips below
- To clear your errors, you will need to edit your build_loop.yml as described here, however these templates should not require any editing.
Troubleshoot
If you were successful in building Loop before you added the customization, and now your Action->Build Loop fails,
- Dana pump only: update your build_loop.yml to macOS 15 and Xcode 16.1
- Troubleshoot using the information in this link
If you need help, post on Facebook with the link to your build_loop.yml file, which is the most important troubleshooting tool. Do not provide screenshots. Click anywhere on the line below and it will copy into your buffer. Just substitute your GitHub username for username
https://github.com/username/LoopWorkspace/blob/main/.github/workflows/build_loop.yml
Update
Once you add your customizations to the build_loop.yml file, your customizations will carry forward to future updates without your taking any special action. Loop 3.4’s automated build function will update your code and rebuild Loop for you. You just need to install it from TestFlight.
Mac-Xcode Build
To customize with the Mac-Xcode build method, you need to follow these steps (full details below):
- Update to Xcode 16.1 (Dana pump only)
- Open Terminal
- Copy
- Paste
- Check for Errors
- Build Loop
- Troubleshoot (if necessary)
- Update
Dana Pump Only
Make sure that your Xcode is updated to 16.1 or higher. (It has been tested and will build using macOS 14.5 with Xcode 16.1.)
Open Terminal
Navigate to your LoopWorkspace folder, see LoopDocs: Find My Downloaded Loop Code
The image below shows what your screen should look like. You should have two windows open:
- Finder> Downloads folder
- Terminal window at LoopWorkspace (see image below)
- Type cd, then use your spacebar to add a space
- Drag your LoopWorkspace folder to your terminal window
Copy
WARNING – these templates only work from the original language version – do not copy and paste from a translated page.
Copy the template for your desired customizations
Paste
- Paste the copied content into your Terminal window
- Click Return
- Your Terminal screen should look like the images below
Check-for-Errors
- After Terminal has completed downloading your customization, it will return to “LoopWorkspace %”
- Make sure there are no errors in Terminal. Use command-f to search for “errors” (without the quotes)
- If you have errors in Terminal, post on Facebook or Zulipchat’s Dana channel or xDrip4iOS channel with
- Description of customization(s) that you’re trying to add
- Date of Loopcode download
- Screenshot(s) of your errors
- Use command shift 3 to capture a screenshot of your entire desktop, or
- Use command shift 4 to capture just the Terminal window itself.
- Xcode version (provide the exact version number, rather than say it is “the latest”)
- Troubleshooting steps you have already taken
Troubleshoot
If you were successful in building Loop before you added the customization, and now it fails,
- Dana pump only: make sure that your Xcode is updated to 16.1 or higher.
- Use command shift 3 to capture a screenshot of your complete Xcode screen, as well as your customization code in Terminal and post on Facebook.
Add xDrip4iOS Client to Loop 3.4 or Later
Read the documentation for this customization before adding it to your Loop app: xDrip4ios Client. Looping with xDrip4iOS requires the xDrip4iOS app, as well as this client that connects Loop to xDrip4iOS.
To copy the lines below, click on any line to copy the entire block to your clipboard. The words “Copied to Clipboard” will appear briefly. Insert the copied text into Terminal or build_loop.yml file as directed above.
echo "Downloading code to support xdrip-client-swift"
git clone https://github.com/johandegraeve/xdrip-client-swift-1.git xdrip-client-swift
echo "checking out the xdrip-client-swift commit that works with Loop 3.4.0 or later"
cd xdrip-client-swift; git checkout e618d67 --quiet; cd ..
echo "Applying customization to add CGM support to Loop for xDrip4iOS"
curl https://github.com/loopandlearn/LoopWorkspace/commit/4097af116ab869084329660c4761bbddff5b7d03.patch | git apply
Add Dana Pump to Loop 3.4 or Later
WARNING: The use of this pump with Loop is experimental. Be very cautious.
- Read the Dana Pump documentation before adding Dana to your Loop app.
- Follow along in zulipchat.
- Put a watch on the DanaKit repository to be notified of updates to the code
- Join the Trio Discord server for another place to interact with and learn from other Dana users. Trio is an iOS-based OS-AID (Open Source Automated Insulin Delivery) system that is also compatible with Dana pumps. While Trio’s algorithm is different from Loop’s, there are few Dana users in the OS-AID community and this is another way for you to keep up to date.
**Important: Requires at least Xcode 16.1**
To copy the lines below, click on any line to copy the entire block to your clipboard. The words “Copied to Clipboard” will appear briefly.
# Instructions for adding Dana pump to Loop 3.4.4
echo "Update to Fastlane 2.225.0"
curl https://github.com/loopandlearn/LoopWorkspace/commit/8f8d742fae10d264e357af5624f7616ecd5ca973.patch | git apply
echo "Downloading code to support Dana pump"
git clone --branch=loop https://github.com/loopandlearn/DanaKit
echo "Applying customization to add Dana support to Loop"
curl https://github.com/loopandlearn/LoopWorkspace/commit/155d2e4a89ab5e7e6b423c67f8c0ccb132517ca4.patch | git apply