Archive for October, 2010

Getting garmin-sync to work after Arch Linux switch to python 3

October 28th, 2010

As many Arch Linux users propably noticed, the Arch Linux team decided to move from python 2 to 3 as default ( Quite some people wasn’t too fond of this (

Well it affects quite a lot of third party applications written for Python 2.x. One of them being garmin-sync (, which I use to pull data from my GPS running watch (Garmin Forerunner 305). So I decided to find a way to make it work again.

  1. Open a terminal and change to the folder where you have garmin-sync installed.
  2. Now we need to change the default interpreter of all python scripts belonging to garmin-sync:
    [jakob@jarch garmin]$ sed -i -e "s|env python$|env python2|" *.py
    [jakob@jarch garmin]$ sed -i -e "s|env python$|env python2|" garmin-sync
  3. As garmin-sync uses pyusb which is written for python 2.x, we need to make some adjustments to the PKGBUILD: Reinstall the package from AUR:
    [jakob@jarch garmin]$ yaourt -S pyusb
  4. When given the option to edit PKGBUILD press “Y”.
  5. Change “python” to “python2″ in depends-section and under build() as so:
    # Contributor: Jason Giangrande <>
    pkgdesc="A native Python module written in C which provides USB access."
    arch=('i686' 'x86_64')
    depends=('python2' 'libusb')
    build() {
            cd $startdir/src/$pkgname-$pkgver
            python2 install -f --root=$startdir/pkg || return 1
  6. I have a script which unloads the garmin gps module (this is needed to run garmin-sync), and then runs garmin-sync as su, in this I also needed to change python to python2:
    # Unload garmin gps module
    sudo modprobe -r garmin_gps
    # Run sync as su
    sudo python2  garmin-sync
  7. Et voilá!
FacebookDeliciousTwitterDiggLinkedInGoogle BookmarksShare

Arch Linux , , , , ,