It is sometimes desirable to compile Tor from source, and perhaps run an unreleased version (e.g., to test the latest changes, use new features unavailable in the latest release, etc.). What is the procedure for doing so?


To compile and install Tor from git follow these steps:

Step 0: Make sure you have git, a working "C compiler" and "GNU make" installed on your linux box. You also need libevent-dev and libssl-dev libraries before you start.

If you're on debian/ubuntu type:

 sudo apt-get install git build-essential automake libevent-dev libssl-dev zlib1g-dev
  • Step 1: Clone Tor from git.torproject.org

    git clone https://git.torproject.org/tor.git

  • Step 2: cd tor

  • Step 3: run ./autogen.sh
  • Step 4: run ./configure or ./configure --disable-asciidoc if you don't want to build the manpages.
    (See 'note' if you get error at this step)
  • Step 5: run make
  • Step 6 (optional): run make install

Note: If you have problems finding libraries at step 4 try the following instead:

CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" \ ./configure


./configure --with-libevent-dir=/usr/local

And if you have mysterious autoconf failures while linking openssl, consider setting your LD_LIBRARY_PATH to the openssl lib directory.

For example: setenv LD_LIBRARY_PATH /usr/your_username/lib.

see INSTALL for more details.

  • 3
    I very rarely make install at the end. Once I've run make, I have a src/or/tor binary and I can just run it in place. That way I don't have to worry about smearing anything over my filesystem. Sep 26 '13 at 10:10
  • I added "make install" just to fit the question. Maybe it'd be better to change the question to "How to compile Tor from git?" and remove "make install"?
    – mrphs
    Sep 26 '13 at 13:34
  • 1
    Your INSTALL link points to the latest commit, which is not very helpful.
    – lorenzog
    Apr 21 '15 at 11:32
  • Is there an instruction how to run it with systemd? May 3 at 11:00

UPDATE (after Roger Dingledine's comment):

Please, do not use the "--enable-bufferevents" feature for stable installations. It's not mature yet.

The --enable-bufferevents option has not ever worked. It is a partial feature that needs somebody to finish it.

./configure --disable-asciidoc

From changelog:

Tor can now optionally build with the "bufferevents" buffered IO backend provided by Libevent 2. To use this feature, make sure you have the latest possible version of Libevent, and pass the --enable-bufferevents flag to configure when building Tor from source. This feature will make our networking code more flexible, let us stack layers on each other, and let us use more efficient zero-copy transports where available.

  • What are the "standard" build options? That is, what build options would yield a binary that's closest to the released binary? Where can that information be found?
    – mirimir
    Aug 4 '14 at 20:55
  • @mirimir Good question. I read the script './configure' to realize all the options and its defaults values.
    – nergeia
    Aug 6 '14 at 9:19
  • Yes, there are many options. Maybe I'm being obtuse. If there are options with defaults, the standard build obviously uses the defaults, right? But even so, I'd like confirmation from someone knowledgeable.
    – mirimir
    Aug 6 '14 at 18:13
  • 1
    Alas, the --enable-bufferevents option has not ever worked. It is a partial feature that needs somebody to finish it. Sorry for the confusion! Sep 24 '14 at 2:54

Git source is really easy stuff for install tor. But I want to tell the easiest alternative way for installing tor from official tor source code. This following commands for Centos. If you're using other Linux, install libevent-devel, groupinstall 'Development Tools' from your default package manager(apt-get or any other).

root @ Centos.

  • Step 1:wget https://dist.torproject.org/tor-
  • Step 2:tar -xf tor- and mv tor- tor
  • Step 3:sudo yum groupinstall 'Development Tools'
  • Step 4:yum install libevent-devel
  • Step 5:cd tor
  • Step 6:./configure
  • Step 7:make
  • Step 8:make install
  • Step 9:run tor

I hope this answer will helps you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.