Building OpenCog

From OpenCog
(Redirected from Build)

GNU/Linux is the primary development platform for OpenCog. The reference configuration used for continuous integration is Ubuntu, starting from 14.04. Although OpenCog should be compatible with any GNU/Linux distribution, Ubuntu is the recommended platform for development.

Setting Development Environment

These are options for setting development environment for working on opencog and it's subprojects.



If you prefer to manually install opencog and its dependencies, jump directly to the Building Section, and install whatever library CMake complains about. The only mandatory library is boost, the others depend on the projects and components that you wish to build.

Otherwise, for automatic installation, follow the instructions below.



For a quick start using Ubuntu version >= 16.04, use octool script.

  • get it by running
sudo curl -L -o /usr/local/bin/octool &&\
sudo chmod +x /usr/local/bin/octool &&\
  • Options that are available can be displayed by running
octool -h
  • To install all dependencies necessary to build OpenCog run
octool -rdcpav -l default
# Optional: Add -s for installing dependencies for haskell binding.
  • To install all dependencies necessary to build AtomSpace and MOSES run
octool -rdcv
# Optional: For atomspace add -s for installing dependencies for haskell binding.
  • To install all dependencies necessary to build Cogutil run
octool -rdv

For a quick start using Raspbian OS on RPI3 board, use octool_rpi script.

  • get it by running
wget && chmod +rx

The script is suppose to run both on the cross-compiling PC and the RPI3 running Raspbian. More info here

  • To Install base dependencies and install opencog with pre-compiled binaries (it may be outdated) on RPI3 running Raspbian
./ -do
  • To cross compile on a much larger computer. This option cross-compiles opencog along with its dependencies (cogutil and atomspace) and creates a debian package.
./ -tc

For building opencog or updating it's dependencies scroll to the sections below

Other GNU/Linux Distributions

On systems that have other GNU/Linux OS installed, use the appropriate script for installing system dependencies. Distros which have dependency installation scripts are,

Virtual Machine

For using Ubuntu in virtual machine managed by vagrant for repo, first install the tools for your os and then follow instruction below under Run Vagrant.

Windows setup

Mac setup

Linux setup

Install VirtualBox, git and vagrant. See here on instructions on vagrant installation.

Run Vagrant

The virtual machine created has all the dependencies required for working on cogutils, atomspace, moses, and opencog.

If you are new to vagrant, see or if you like to understand what vagrant is. Understanding the working of vagrant is not required for contributing to opencog.

The common steps after installing VirtualBox, git and Vagrant for your os and running a bash(on windows use the equivalent powershell commands) shell are:

mkdir opencog_repos
cd opencog_repos
git clone

# You can clone other repos if you so choose

ln -s $PWD/opencog/lib/Vagrantfile Vagrantfile
vagrant up
vagrant ssh

# The folder from which your run 'vagrant up' is accessiable at
# '/home/vagrant/opencog' on sshing into the virtual machine.

# Do your thing

vagrant halt

For building opencog or updating it's dependencies scroll to the sections below


For using containers managed by docker, follow instructions here.

For building opencog or updating its dependencies scroll to the sections below

Other OS


Build OpenCog using the following commands after moving to the root of the three cloned directories (cogutil, atomspace, optionally moses, and opencog, in that order) or the corresponding directories in your vagrant/docker setup:

mkdir build
cd build
cmake ..
make -j$(nproc)
sudo make install

Provided you have Python2 and Python3 development libraries installed, and only want to build atomspace/opencog python-bindings against Python2, instead of the default Python3, run the following commands

mkdir build
cd build
make -j$(nproc)
sudo make install

If you are using octool from the git clone directory, run

octool -b

Updating Dependencies

To update your opencog's sub-project installations(cogutil, link-grammar and atomsapce), as they are in a continues state of development, you will need to run these series of commands, once/multiple times a week/day depending on what type of fun you are having with opencog, from your git clone.

If you are using octool, run

octool -cal


For saving and sharing the contents of the AtomSpace. See StorageNode for a general overview.


RocksDB is recommended, vs. Postgres: its faster, smaller, and there's nothing to configure. (Installing and configuring Postgres is hard.)

See for install instructions.

See RocksStorageNode for usage details.

Network serving

Multiple AtomSpaces can share Atoms with one-another, over the network. This uses exactly the same API asthe toher StorageNodes. See CogStorageNode and CogServer.


See instructions here

  • If you are using octool then use -rd option for installing dependencies.
  • If you are using docker full configuration are done for you.

See PostgresStorageNode for usage details.