wiki:doc/MacBuild

Building Command-Line Tor on macOS

Pre-Packaged Alternatives

Go to https://www.torproject.org/download/download-easy.html.en#mac to install a pre-built Tor Browser on macOS, including a recent command-line tor.

Go to https://www.torproject.org/docs/tor-doc-osx.html.en to install a command-line tor binary, or build it from source. The current MacPorts version of tor is 0.3.1.8

Obtaining a Recent libevent

  1. Go to http://libevent.org/
  2. Download the latest stable libevent tar.gz, currently 2.1.8
  3. Go to the “Building libevent from source” instructions below

PGP keys to verify the libevent source.

Nick Mathewson http://www.wangafu.net/~nickm/ 2133 BC60 0AB1 33E1 D826 D173 FE43 009C 4607 B1FB

Azat Khuzhin https://launchpad.net/~azat 9E3AC83A27974B84D1B3401DB86086848EF8686D

Niels Provos http://www.citi.umich.edu/u/provos/ B683 13D0 C293 9222 D26E DFD6 13C2 15C0 6A45 C816

Obtaining a Recent OpenSSL

The included OpenSSL 0.9.8 on macOS is too old to build tor. You need at least OpenSSL 1.0.

Build or install the x86_64 architecture of OpenSSL's stable or developer version:

Installing Pre-Built Binaries

  1. Use the instructions at https://www.torproject.org/docs/tor-doc-osx.html.en to install MacPorts, but don't install tor
  2. Run: port install openssl

This installs the latest version of tor.

Building libevent from source

  1. ./configure
  2. make
  3. make verify # (optional)
  4. sudo make install

This installs libevent (currently 2.1.8)

Obtaining Stable OpenSSL

  1. Go to https://www.openssl.org/source/
  2. Download the latest stable OpenSSL tarball
  3. Go to the Building OpenSSL from Source instructions below

Obtaining Development OpenSSL

  1. Go to https://github.com/openssl/openssl
  2. Clone the latest development version of OpenSSL using git
  3. Go to the Building OpenSSL from Source instructions below

Building OpenSSL from Source

  1. Run: ./Configure --prefix=/usr/local/ssl darwin64-x86_64-cc
  2. Run: make depend
  3. Run: make
  4. Run: make test # Ignore any gost failures in make test
  5. Run: sudo make install

PGP keys used to verify the OpenSSL source can be found. https://www.openssl.org/community/omc.html

Building Tor

Obtain Tor source code

Download a tor source tarball from https://dist.torproject.org/

PGP keys used to verify the Tor source. https://www.torproject.org/docs/signing-keys.html Roger Dingledine (0x28988BF5 and 0x19F78451) or Nick Mathewson (0xFE43009C4607B1FB with signing key 0x6AFEE6D49E92B601) used to sign the Tor source code tarballs.

OR

Clone the tor git repository from https://git.torproject.org/tor.git and checkout a stable or unstable branch

To build Tor from a just-cloned git repository:

  1. Run: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" Close Terminal and reopen it before step 2.
  1. brew install automake && brew install asciidoc
  1. sh autogen.sh

After autogen is finished Continue to Configure and Build Tor

Configure, Build and install Tor

  1. Run: ./configure --prefix=/usr/local/tor --with-openssl-dir=/usr/local/ssl --with-libevent-dir=/usr/local/lib && make && make check && sudo make install

Optional you can add --disable-asciidoc flag to the ./configure command to build without manpages.

You should now have a working tor installation in /usr/local/tor

The Torrc File is location is at /usr/local/tor/etc/tor and it is called "torrc.sample". Edit the torrc file and save it, then remove the .sample from the file name before running Tor.

Enter /usr/local/tor/bin/tor into terminal and click Return to start Tor.

If you get a error similar to " Found linkable libevent in (system), but it does not seem to run, even with -R. Maybe specify another using --with-libevent-dir}" go to "Obtaining a Recent libevent"

Running Tor

See https://trac.torproject.org/projects/tor/wiki/doc/MacRunOnBoot to run Tor under launchd.

Last modified 7 weeks ago Last modified on May 26, 2018, 8:24:49 PM