Setup Homebridge to Start on Bootup

I’ve recently been playing with Homebridge on my Raspberry Pi. I’ve setup my Harmony Hub and my wireless power outlets to be controlled by Siri on my iPhone. Overall it has been pretty simple to setup but I did run into an issue trying to get Homebridge to start on bootup. Homebridge suggest 3 different methods

I decided to use systemd to start Homebridge on bootup. I prefered this method because it will restart if an error occurs. I followed the gist setup step by step but ran into some problems.

My main issues were:

  • The location of my homebridge binary. Step 2
  • Permissions were not correct and the service failed to load. Step 7
  • I needed the persist folder in /var/homebridge directory. Step 6

Here are the steps that worked for me:

  1. sudo nano /etc/default/homebridge and paste this gist
  2. sudo nano /etc/systemd/system/homebridge.service and paste this gist
    1. I had to remove local from:  ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS  because my homebridge installed in /usr/bin/
  3. Create a user to run service: sudo useradd --system homebridge
  4. sudo mkdir /var/homebridge
  5. sudo cp ~/.homebridge/config.json /var/homebridge/
    1. This copies your current user’s config. This assumes you have already added accessories etc.
  6. sudo cp -r ~/.homebridge/persist /var/homebridge
  7. sudo chmod -R 0777 /var/homebridge
  8. sudo systemctl daemon-reload
  9. sudo systemctl enable homebridge
  10. sudo systemctl start homebridge

Type systemctl status homebridge to check the status of the service.

Hopefully this helps anyone who is having trouble with Homebridge starting on boot on a Raspberry Pi. Please comment below if you have any questions.

Also published on Medium.

170 thoughts to “Setup Homebridge to Start on Bootup”

  1. My Homebridge works well on my Raspberry Pi 3, but I cannot get autostart to work using the guidelines.
    I have checked the location of homebridge and included it in the Gist with ‘local’

    [email protected]:~ $ which homebridge

    I get an error when I use systemctl status homebridge

    [email protected]:~ $ systemctl status homebridge
    ● homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled)
    Active: activating (auto-restart) (Result: exit-code) since Thu 2017-09-21 15:44:26 UTC; 8s ago
    Process: 17090 ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS (code=exited, status=1/FAILURE)
    Main PID: 17090 (code=exited, status=1/FAILURE)

    1. I had this issue as well – I’m using the Braoadlink RM plug in and I had to add the following line to the BroadlinkRM platform in /var/homebridge/config.json


      Hope this helps

  2. Hello,
    Just to say Thank you very much, I have some difficult to start my home bridge at startup and with your steps it’s works fine !!
    Thanks again!

  3. Hi TIM, I’ve done every step and I see the system is running
    homebridge.service – Node.js HomeKit Server
    Loaded: loaded (/etc/systemd/system/homebridge.service; enabled; vendor preset: enabled)
    Active: active (running) since Tue 2017-09-26 11:32:38 UTC; 14s ago
    Main PID: 692 (homebridge)
    CGroup: /system.slice/homebridge.service
    ├─692 homebridge
    ├─698 /bin/sh -c /bin/echo -n “$(npm -g prefix)/lib/node_modules”
    └─699 npm

    BUT when I go on my phone homekit doesn’t work, and in order to switch on my lights I have to start “homebridge” manually.
    What it can be?

          1. I don’t understand why create another user (called homebridge, too, to confuse ideas to noobs!).. should I do something with that user? If I try to switch from pi user to homebridge user, it asks me a password, which password?

            Thanks 🙂

    1. I had the same issue. I had to remove the bridge from my Home app and then re-pair it with the auto-started instance (even using the same HomeKit code) before it would work with the autostarted one.

  4. Hi, I’m new to all this and started out reading how to setup my homebridge on The post refers to the post above in case you encounter some difficulties (aka troubleshooting). In the first post the homebridge config is stored in /var/homebridge, while in the post above the dir /var/lib/homebridge is used. Be sure the locations in you config are matching the directories you’ll be creating, so pick one or the other. After correcting the post above did the job for me, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *