Installing OpenCog for Noobs

From OpenCog



This page describes how to install the dependencies and source code for OpenCog in an Ubuntu 14.04 LTS environment. It is in the process of being updated from the Ubuntu 12.xx guide; please edit or report any errors.

If you are running an earlier or later version of Ubuntu, or a different Linux distribution, you can still use these instructions as a guide by replacing ocpkg with ocbootstrap in step 3.3.


This page has the following prerequisites:


Getting to the command line

This supposes you are using an Ubuntu VM (virtual machine). If that is not the case, skip to the next subsection.

Start your Ubuntu VM and let it boot up. You will be asked to log in with the username and password you provided during installation. After that you should see a blank desktop.

(Note: In some cases, your VM may not launch due to the VMWare Tools installation breaking. See this link for slightly dated instructions on how to solve similar problems.)

Presuming you have successfully reached the Ubuntu desktop, look to the left launcher menu. All the way at the top, you should see an Ubuntu icon. Click on this, and start typing 'Terminal' in the search box. It should find a program called Terminal which is your main command prompt inside Ubuntu. Click this and you should get a fresh command prompt starting in your home directory.

Installing CogBuntu Start Terminal.png

How to Install OpenCog and its dependencies in a nutshell

There are numerous ways to install OpenCog. In short, the process consists of:

  • Getting the source code.
  • Installing dependencies for OpenCog to run.
  • Building OpenCog.

First, install various required dependencies. The recommended method is via ocpkg. You can find ocpkg and its instructions here:

Next, prepare a directory or Desktop (or wherever) in which you will do your work (using the mkdir command). You'll need to have git installed on your computer; the oskpg command should have done this.

cd ~ (or wherever you'd like this main directory to be)
mkdir OPENCOG (or whatever you'd like to call this main directory)
cd OPENCOG (you'll prepare all of your OpenCog repositories in here)
git clone
git clone
git clone
git clone
git clone
git clone
git clone
git clone
git clone
git clone
git clone

Then, you will build and install each of the repositories named above. They all work exactly the same.

cd <reponame>
mkdir build
cd build
cmake ..
make -j6
**make -j6 test**
sudo make install  (you'll be prompted for a password)
cd ../..    # to OPENCOG/

Then, if everything has worked, you should be able to ??? read the instructions on what to do next.

Older instructions: First Steps for **expert** users: those familiar with git, Github, and Linux

These brief instructions are for expert users. If you are not an expert user, or any of the above terms are unfamiliar to you, skip to the next subsection.

OpenCog's source code is available from Github at:

In order to quickly install all dependencies, you will need to run these series of commands.

git clone
wget -O octool && chmod +rx octool && ./octool -rdpcal

Build OpenCog using the following commands after moving to the root of the git clone:

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

You are now ready to play with OpenCog. Well, you will be. Installation tends to take several minutes.

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

 wget -O octool && chmod +rx octool && ./octool -cal

Older instructions: First Steps For **non-expert** users: those unfamiliar with git, Github, or Linux

Please follow the section above for experts, these section hasn't been updated for a while, thanks

These lengthy instructions are for non-expert users. If you have already downloaded the OpenCog source and dependencies, skip to the next section.

In your terminal window, you should end up in your own home directory (~username). The steps we'll be going through are:

  • Download and run a script to install all the dependencies.
  • Download the Opencog source code and build it.
  • Make a local 'fork' of source code.
  • Build the code again.
  • Build and run the tests.

Installing the dependencies for OpenCog is a matter of running a script which will install all of them one by one. This script is the ocpkg script, which you will download.

First go to your home directory using this command:

cd ~

The command below downloads and installs all the required packages for Ubuntu 14.04, downloads the latest version of the OpenCog source files and compiles them. (Link verified as of December 7 2014)

wget && chmod ugo+rx ocpkg && ./ocpkg -v

You will be prompted for your administrator password in order to install dependencies.

This can take a while (depending on your computer / internet speed), and might prompt you to confirm (press 'y') that you're ok with the amount of diskspace some of the packages require. Once this is done it should tell you 'Libraries and tools for OpenCog installed' and will then move on to downloading and building the OpenCog source files.

At the end of the build process, it should tell you

[ocpkg] Exiting ocpkg normally...

You should now have a folder called 'opencog', containing a folder called 'src' with all the actual project files in it.

Dependency Notes for Troubleshooting

If you are not having trouble with your installation, please skip this section. Refer to it later if problems with embodiment arise.

It is possible that, if the code is currently mid maintenance cycle, a dependency might not yet be included with ocpkg. At the time of writing, ocpkg should successfully install a library called xerces 3.1 with which we have had some difficulties. The command for installing this dependency manually would be:

sudo apt-get install libxerces-c3.1 libxerces-c-dev

If necessary, xerces 2.x can be removed with:

sudo apt-get remove libxerces-c2-dev, libxerces-c28 and libxerces2-java

Common symptoms of an incorrect xerces installation include that, when building OpenCog, OpenCog reports the embodiment will NOT be built.

Rebase the source code to your own fork

'Rebasing source code to your own fork' is a common Github practice. If you're just downloading OpenCog to see what it does you can skip this step. If you want to know more about working with our open source community and contributing to OpenCog, see our guide at [Standards]

If already you have your own fork of the OpenCog source code (for example, through Creating your own fork of OpenCog), you should rebase the repository the ocpkg script created for you in ~/opencog/opencog to target your own fork.

If you need backwards compatibility with a test or tutorial

Some of the tutorials on this website still expect you to be working from a 'bin' folder inside the OpenCog folder, which no longer exists. If you find you need this folder, you can run the script below to create this folder along with the required symbolic links (folder redirections) so that the components that the system expects to exist under the bin folder will redirect to the built components in the 'build' folder.

First go to the root folder of OpenCog, which should be:

cd ~/opencog

And then run the script:


You should now find the backwards compatibility links in the 'build'.

Build and run the tests

To run the tests, go to your opencog/build folder (assuming your opencog folder is in your home directory ~):

cd ~/opencog/build

Prepare the makefiles:

cmake ..

The following command will run all the (unit) tests in the Opencog source to make sure everything will actually work like it should.

make test

Again, if you run into any fatal errors here, feel free to report the issue on GitHub.

You have now compiled OpenCog! Congratulations! Feel free to call friends and family now to inform them of your new career as an AI developer!


Great, what now?

Now you have an OpenCog environment ready to work with!
Some other options for the motivated learner to look into are described below:
If your interest is genetic algorithms consider exploring the MOSES man commandline tool. The AtomSpace is CogPrime's central knowledge store and is one of OpenCog's most central features. Learning about it is essential to understanding the entire OpenCog architecture. DeSTIN is a sophisticated deep learning algorithm that is being applied to visual problems, so if your interest is machine vision this may be a great place to start. Some work has been done with Natural Language Processing and there is a collection of experiments related to this domain that you could explore. To get a better grasp of the whole system consider reading Building Better Minds.