Posting Apple Watch Workouts to Strava

Until the latest release to Apple Watch seemed not to be useful to me. But with Apple Watch Series 3 and WatchOS4 several things are fixed. There is no need anymore to carry the phone during exercise and it's possible to access all training data by HealthKit.

The battery should last for the usual run or short ride. I expect the watch to last at least for a 10h ride.

My current workflow

I use Garmin devices to track my runs and rides and Rubitrack to manage and analyse the data1. The Garmin devices transfer the data to Garmin Connect automagically, but the sync from Garmin Connect to Rubitrack was not stable for a long time. Therefore I linked Garmin Connect to Strava. This gave me not only a stable sync (Rubitrack <-> Strava) but also access to a huge cycling community.

Apple Watch

The Apple Watch has a built-in heart rate monitor. Leaving the chest-strap at home for training and commuting makes preparation a lot easier. Also there is no need to mount/demount the Edge unit on the bicycle for commuting. The only flaw at the moment is that it is not possible to connect the watch to a cadence sensor. So, for serious cycling-exercises I have to switch back to my old set-up.

WatchOS 4

With WatchOS 4 HealthKit allows access to the workout-route. What would be nicer than read the workout (including heart rate data and the route taken) and write it to Strava.

Initial Approach

My initial approach was to write an app for the phone which reads the selected workouts and write the selected data to Strava. While gathering information how to do this I stumbled upon an app which was already able to write workouts into GPX-files. I decided to use this app and built a bit of logic around it.

Final approach

I now use GPXExporter to write the workouts as GPX files to a local git repository on my iPhone. On my server I installed a post-receive hook which posts the workouts to Strava by using stravacli.


TMP_GIT_CLONE=$(mktemp -d)

unset GIT_DIR


for f in GPXfiles/*.gpx; do

if [ -e "$f" ]

   PYTHONIOENCODING=UTF-8 ./bin/ -P GPXfiles/*.gpx

   git mv -f GPXfiles/*.gpx processed/
   git commit -m "Files were processed by StravaCLI"
   git push

   echo "Nothing to do"



The PYTHONIOENCODING=UTF-8 is necessary because I used the emoji expression of my last name in Strava.

After a push my workouts are posted to Strava without the need to access a computer. Of course it would be nicer if Strava would allow to post workouts directly on the phone by providing an action extension for that.

  1. It's vital for me to be able to do that locally without network access.