wiki:doc/MacBuild

Version 7 (modified by Dbryrtfbcbhgf, 3 years ago) (diff)

--

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.0.10

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 Stable libevent from source instructions below

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

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, currently 1.0.2l
  3. Go to the Building OpenSSL from Source instructions below

Obtaining Development OpenSSL

  1. Go to https://www.openssl.org/source/repos.html
  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

Building Tor

Obtain Tor source code

Download a tor source tarball from https://archive.torproject.org/tor-package-archive/

OR

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

Configure and Build Tor

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

You should now have a working tor installation in /usr/local/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.