If you just want to install kubo, please download it from https://dist.ipfs.tech/#kubo. This document explains how to build it from source.
kubo
is built on Golang and thus depends on it for all building methods.
https://golang.org/doc/install
The GOPATH
environment variable must be set as well.
https://golang.org/doc/code.html#GOPATH
kubo
utilizes make
to automate builds and run tests, but can be built without it using only git
and go
.
No matter which method you choose, if you encounter issues, please see the Troubleshooting section.
Using make
:
MSYS2 and Cygwin provide the Unix tools we need to build kubo
. You may use either, but if you don't already have one installed, we recommend MSYS2.
MSYS2→
Cygwin→
Using build tools manually:
This section assumes you have a working version of go
and git
already setup. You may want to build this way if your environment restricts installing additional software, or if you're integrating IPFS into your own build system.
Minimal→
- Install msys2 (http://www.msys2.org)
- Run the following inside a normal
cmd
prompt (Not the MSYS2 prompt, we only need MSYS2's tools).
An explanation of this block is below.
SET PATH=%PATH%;\msys64\usr\bin
pacman --noconfirm -S git make unzip
go get -u github.com/ipfs/kubo
cd %GOPATH%\src\github.com\ipfs\kubo
make install
%GOPATH%\bin\ipfs.exe version --all
If there were no errors, the final command should output version information similar to "ipfs version 0.4.14-dev-XXXXXXX
" where "XXXXXXX" should match the current short-hash of the kubo
repo. You can retrieve said hash via this command: git rev-parse --short HEAD
.
If ipfs.exe
executes and the version string matches, then building was successful.
Command | Explanation |
---|---|
SET PATH=%PATH%;\msys64\usr\bin |
Add msys2's tools to our PATH ; Defaults to: (\msys64\usr\bin) |
pacman --noconfirm -S git make unzip |
Install kubo build dependencies |
go get -u github.com/ipfs/kubo |
Fetch / Update kubo source |
cd %GOPATH%\src\github.com\ipfs\kubo |
Change to kubo source directory |
make install |
Build and install to %GOPATH%\bin\ipfs.exe |
%GOPATH%\bin\ipfs.exe version --all |
Test the built binary |
To build again after making changes to the source, run:
SET PATH=%PATH%;\msys64\usr\bin
cd %GOPATH%\src\github.com\ipfs\kubo
make install
Tip: To avoid setting PATH
every time (SET PATH=%PATH%;\msys64\usr\bin
), you can lock it in permanently using setx
after it's been set once:
SETX PATH %PATH%
- Install Cygwin (https://www.cygwin.com)
- During the install, select the following packages. (If you already have Cygwin installed, run the setup file again to install additional packages.) A fresh install should look something like this reference image.
- devel packages
git
make
- archive packages
unzip
- net packages
curl
- devel packages
- Run the following inside a normal
cmd
prompt (Not the Cygwin prompt, we only need Cygwin's tools)
An explanation of this block is below.
SET PATH=%PATH%;\cygwin64\bin
mkdir %GOPATH%\src\github.com\ipfs
cd %GOPATH%\src\github.com\ipfs
git clone https://github.com/ipfs/kubo.git
cd %GOPATH%\src\github.com\ipfs\kubo
make install
%GOPATH%\bin\ipfs.exe version --all
If there were no errors, the final command should output version information similar to "ipfs version 0.4.14-dev-XXXXXXX
" where "XXXXXXX" should match the current short-hash of the kubo
repo. You can retrieve said hash via this command: git rev-parse --short HEAD
.
If ipfs.exe
executes and the version string matches, then building was successful.
Command | Explanation |
---|---|
SET PATH=%PATH%;\cygwin64\bin |
Add Cygwin's tools to our PATH ; Defaults to: (\cygwin64\bin) |
mkdir %GOPATH%\src\github.com\ipfs cd %GOPATH%\src\github.com\ipfs git clone https://github.com/ipfs/kubo.git |
Fetch / Update kubo source |
cd %GOPATH%\src\github.com\ipfs\kubo |
Change to kubo source directory |
make install |
Build and install to %GOPATH%\bin\ipfs.exe |
%GOPATH%\bin\ipfs.exe version --all |
Test the built binary |
To build again after making changes to the source, run:
SET PATH=%PATH%;\cygwin64\bin
cd %GOPATH%\src\github.com\ipfs\kubo
make install
Tip: To avoid setting PATH
every time (SET PATH=%PATH%;\cygwin64\bin
), you can lock it in permanently using setx
after it's been set once:
SETX PATH %PATH%
While it's possible to build kubo
with go
alone, we'll be using git
to fetch the source.
You can use whichever version of git
you wish but we recommend the Windows builds at https://git-scm.com. git
must be in your PATH
for go get
to recognize and use it.
Clone and change directory to the source code, if you haven't already:
CMD:
git clone https://github.com/ipfs/kubo %GOPATH%/src/github.com/ipfs/kubo
cd %GOPATH%/src/github.com/ipfs/kubo/cmd/ipfs
PowerShell:
git clone https://github.com/ipfs/kubo $env:GOPATH/src/github.com/ipfs/kubo
cd $env:GOPATH/src/github.com/ipfs/kubo/cmd/ipfs
We need the git
commit hash to be included in our build so that in the extremely rare event a bug is found, we have a reference point later for tracking it. We'll ask git
for it and store it in a variable. The syntax for the next command is different depending on whether you're using the interactive command line or writing a batch file. Use the one that applies to you.
- interactive:
FOR /F %V IN ('git rev-parse --short HEAD') do set SHA=%V
- interpreter:
FOR /F %%V IN ('git rev-parse --short HEAD') do set SHA=%%V
Finally, we'll build and test ipfs
itself.
CMD:
go install -ldflags="-X "github.com/ipfs/kubo".CurrentCommit=%SHA%"
%GOPATH%\bin\ipfs.exe version --all
PowerShell:
go install -ldflags="-X "github.com/ipfs/kubo".CurrentCommit=$env:SHA"
cp ./ipfs.exe $env:GOPATH/bin/ipfs.exe -force
. $env:GOPATH/bin/ipfs.exe version --all
You can check that the ipfs output versions match with go version
and git rev-parse --short HEAD
.
If ipfs.exe
executes and everything matches, then building was successful.
-
Git auth If you get authentication problems with Git, you might want to take a look at https://help.github.com/articles/caching-your-github-password-in-git/ and use the suggested solution:
git config --global credential.helper wincred
-
Anything else
Please search https://discuss.ipfs.tech for any additional issues you may encounter. If you can't find any existing resolution, feel free to post a question asking for help.
If you encounter a bug with kubo
itself (not related to building) please use the issue tracker to report it.