Install Homebridge on Windows - Anthony-Chan/homebridge GitHub Wiki
- General information:
This Howto is for Windows 7 & 10 64BIT (Windows 7 & 10 32BIT is untested).
All Programs installed with 32BIT except Microsoft Visual Studio and Apple Bonjour.
- Step 1: You need follow software
1 - GIT 2.8.3 32BIT (https://git-scm.com/download/win)
2 - Visual Studio Community 2015 (https://www.visualstudio.com/products/visual-studio-community-vs)
3 - Python 2.7.11 32BIT (https://www.python.org/downloads/)
4 - Open SSL 1.0.2h 32BIT (http://slproweb.com/products/Win32OpenSSL.html)
5 - Nodejs v5.0.0 32BIT (https://nodejs.org/en/download/releases/)
6 - Bonjour for Developers 3.0.0.10 (https://developer.apple.com/bonjour/)
6.1 - Alternate download location for Bonjour SDK (http://www.softpedia.com/get/Programming/SDK-DDK/Bonjour-SDK.shtml)
7 - getopt.h & getopt.c (http://www.codeproject.com/KB/cpp/getopt4win/getopt_mb_uni_src.zip)
8 - unistd.h (do it yourself => Source: https://github.com/KhaosT/HAP-NodeJS/issues/113)
8.1 - Create a file named unistd.h
8.2 - Open the file unistd.h with Notepad
8.3* - Copy following text in the file unistd.h => Version of Patcher (https://github.com/KhaosT/HAP-NodeJS/issues/113)
#ifndef _UNISTD_H
#define _UNISTD_H 1
/* This file intended to serve as a drop-in replacement for
unistd.h on Windows
Please add functionality as neeeded */
#include
#include
#include
#include /* for getpid() and the exec..() family /
#include / for _getcwd() and _chdir() */
#define srandom srand
#define random rand
/* Values for the second argument to access.
These may be OR'd together. /
#define R_OK 4 / Test for read permission. /
#define W_OK 2 / Test for write permission. /
//#define X_OK 1 / execute permission - unsupported in windows/
#define F_OK 0 / Test for existence. */
#define access _access
#define dup2 _dup2
#define execve _execve
#define ftruncate _chsize
#define unlink _unlink
#define fileno _fileno
#define getcwd _getcwd
#define chdir _chdir
#define isatty _isatty
#define lseek _lseek
/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You
need to look at your app and consider whether to call e.g. closesocket(). */
#define ssize_t int
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
/* should be in some equivalent to */
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif /* unistd.h */
8.3* - Or copy following text in the file unistd.h => Version of WilliamHF (https://github.com/nfarina/homebridge/issues/402)
#ifndef _UNISTD_H
#define _UNISTD_H 1
/* This file intended to serve as a drop-in replacement for
unistd.h on Windows
Please add functionality as neeeded */
/* #include
#include
#include
#include */ /* for getpid() and the exec..() family /
#include / for _getcwd() and _chdir() */
#define srandom srand
#define random rand
/* Values for the second argument to access.
These may be OR'd together. /
#define R_OK 4 / Test for read permission. /
#define W_OK 2 / Test for write permission. /
//#define X_OK 1 / execute permission - unsupported in windows/
#define F_OK 0 / Test for existence. */
#define access _access
#define dup2 _dup2
#define execve _execve
#define ftruncate _chsize
#define unlink _unlink
#define fileno _fileno
#define getcwd _getcwd
#define chdir _chdir
#define isatty _isatty
#define lseek _lseek
/* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You
need to look at your app and consider whether to call e.g. closesocket(). */
#define ssize_t int
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
/* should be in some equivalent to */
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef signed __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif /* unistd.h */
8.4 - Save the file unistd.h
- Step 2: Install with the following order
# - The Windows User-Account must have administrator rights!
1 - Visual Studio Community (C:\Program Files (x86)\Microsoft Visual Studio 14.0)
2 - Python (C:\Python27) => By user settings: Enable path
3 - Open SSL (C:\OpenSSL-Win32)
4 - GIT (C:\Program Files (x86)\Git)
5 - Nodejs (C:\Program Files (x86)\nodejs)
6 - Bonjour for Developers (C:\Program Files (x86)\Bonjour SDK)
7 - RESTART Computer
8 - Copy getopt.h, getopt.c and unistd.h to "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include"
9 - RESTART Computer
- Step 3: Configuration Visual Studio
# - The Windows User-Account must have administrator rights!
1 - Open Visual Studio Community and create a C++ Project to install "dev environment"
2 - RESTART Computer
- Step 4: Running Homebridge
# - The Windows User-Account must have administrator rights!
# - xxx = Your Windows Username (C:\Users\xxx...)
1 - Start GIT-CMD
2 - Console command: npm install -g homebridge
2.1 - If npm install fails with error C2373: "__pfnDliNotifyHook2", try the workaround here: https://stackoverflow.com/questions/38149603/npm-install-fails-with-error-c2373-with-vs2015-update-3
3 - Console command: npm install -g homebridge-http
4 - Check if folder "C:\Users\xxx\.homebridge" exists => The folder is invisible!
4.1 - When folder "C:\Users\xxx\.homebridge" not exists you create this over Windows-CMD
4.1.1 - Open Windows-CMD
4.1.2 - CD C:\Users\xxx\
4.1.3 - mkdir .homebridge
5 - Copy "config-sample.json" from "C:\Users\xxx\AppData\Roaming\npm\node_modules\homebridge-http" to "C:\Users\xxx\.homebridge"
5.1 - Rename the "config-sample.json" to "config.json" (C:\Users\xxx\.homebridge)
6 - Console command: cd C:\Users\xxx\AppData\Roaming\npm\node_modules\homebridge\bin
7 - Console command: node homebridge
8 - Homebridge runs hopefully :)
8.1 - If iOS apps cannot pair to HomeBridge, you may need to add a firewall rules to allow port 51826 (Control Panel > System Security > Windows Firewall > Advanced Settings > Create New Rule to allow TCP 51826)