How to start Tor when your Mac boots, so that it is always running. This should also work for other Unices that use [https://secure.wikimedia.org/wikipedia/en/wiki/Launchd launchd ].
How to start Tor when your Mac boots, so that it is always running. This should also work for other Unices that use [launchd ](https://secure.wikimedia.org/wikipedia/en/wiki/Launchd).
It is called running Tor as a Dameon when you run it at boot.
It is called running Tor as a Dameon when you run it at boot.
== Get Tor Working ==
## Get Tor Working
Get Tor working with your preferences. You probably already have done that before you got to these steps.
Get Tor working with your preferences. You probably already have done that before you got to these steps.
See https://trac.torproject.org/projects/tor/wiki/doc/MacBuild for instructions on installing a recent tor, or building it from source.
See https://trac.torproject.org/projects/tor/wiki/doc/MacBuild for instructions on installing a recent tor, or building it from source.
=== Instructions for Obsolete Tor Manager Vidalia ===
### Instructions for Obsolete Tor Manager Vidalia
Some Tor users used to use [https://www.torproject.org/projects/vidalia.html.en Vidalia]. You can install Vidalia from source using the [http://www.macports.org/ MacPorts tree] or [https://www.torproject.org/projects/vidalia.html.en download an installer ].
Some Tor users used to use [Vidalia](https://www.torproject.org/projects/vidalia.html.en). You can install Vidalia from source using the [MacPorts tree](http://www.macports.org/) or [download an installer ](https://www.torproject.org/projects/vidalia.html.en).
If you are installing Vidalia from Source using the MacPorts tree, you might also considering installing Tor that way as well ("sudo port install tor"). The path for will be installed to will be simpler to type than the path to Tor installed with Vidalia.
If you are installing Vidalia from Source using the MacPorts tree, you might also considering installing Tor that way as well ("sudo port install tor"). The path for will be installed to will be simpler to type than the path to Tor installed with Vidalia.
== Find where your Tor Executable is ==
## Find where your Tor Executable is
You might find it easier to find the location of your Tor executable by starting a Terminal Window and performing
You might find it easier to find the location of your Tor executable by starting a Terminal Window and performing
{{{
```
ps -Ax | egrep "/tor"
ps -Ax | egrep "/tor"
}}}
```
=== Find where your Tor Executable is using Vidalia ===
### Find where your Tor Executable is using Vidalia
If you are using Vidalia, you can use the Preferences menu to find where your Tor executable is.
If you are using Vidalia, you can use the Preferences menu to find where your Tor executable is.
[[Image(locate-tor.png,320px)]]

If you are using the Tor that was installed with Vidalia the path to your Tor executable will be more complicated than the one shown above.
If you are using the Tor that was installed with Vidalia the path to your Tor executable will be more complicated than the one shown above.
...
@@ -37,7 +37,7 @@ If you are using the Tor that was installed with Vidalia the path to your Tor ex
...
@@ -37,7 +37,7 @@ If you are using the Tor that was installed with Vidalia the path to your Tor ex
== Add ControlSocket To Tor Config File ==
## Add ControlSocket To Tor Config File
Add ControlSocket <path> or ControlPort <portnumber> to your torrc as shown in the Vidalia image below.
Add ControlSocket <path> or ControlPort <portnumber> to your torrc as shown in the Vidalia image below.
...
@@ -45,16 +45,16 @@ Once the ControlSocket or ControlPort is set up, you can use nyx to monitor tor
...
@@ -45,16 +45,16 @@ Once the ControlSocket or ControlPort is set up, you can use nyx to monitor tor
See https://gitweb.torproject.org/nyx.git
See https://gitweb.torproject.org/nyx.git
=== Add "ControlSocket To Tor Config File with Vidalia ===
### Add "ControlSocket To Tor Config File with Vidalia
If you are using Vidalia there is a menu option for the tor control socket in the advanced options available from the Preference menu.
If you are using Vidalia there is a menu option for the tor control socket in the advanced options available from the Preference menu.
[[Image(torsocket.png, 320px)]]

If Vidalia doesn't provide a default socket for you as circled in the image above, type the name of one in in your data directory (also circled).
If Vidalia doesn't provide a default socket for you as circled in the image above, type the name of one in in your data directory (also circled).
== Verify the torrc file is still valid ==
## Verify the torrc file is still valid
Create another Terminal window.
Create another Terminal window.
...
@@ -62,23 +62,23 @@ Verify your tor configuration file is valid. It is much easier to find errors n
...
@@ -62,23 +62,23 @@ Verify your tor configuration file is valid. It is much easier to find errors n
Change /opt/local/bin to the path of your Tor executable and /opt/local/etc/tor/torrc to the path of your Tor configuration file.
Change /opt/local/bin to the path of your Tor executable and /opt/local/etc/tor/torrc to the path of your Tor configuration file.
Sep 25 09:18:40.680 [notice] Tor v0.2.2.32 (git-877e17749725ab88). This is experimental software. Do not rely on it for strong anonymity. (Running on Darwin x86_64)
Sep 25 09:18:40.680 [notice] Tor v0.2.2.32 (git-877e17749725ab88). This is experimental software. Do not rely on it for strong anonymity. (Running on Darwin x86_64)
Sep 25 09:18:40.681 [notice] Your ContactInfo config option is not set. Please consider setting it, so we can contact you if your server is misconfigured or something else goes wrong.
Sep 25 09:18:40.681 [notice] Your ContactInfo config option is not set. Please consider setting it, so we can contact you if your server is misconfigured or something else goes wrong.
Configuration was valid
Configuration was valid
}}}
```
== Start a tail on the system log ==
## Start a tail on the system log
This will help debugging if anything goes wrong or you make a typographical error.
This will help debugging if anything goes wrong or you make a typographical error.
In your terminal window,
In your terminal window,
{{{
```
cd /var/log
cd /var/log
tail -f system.log
tail -f system.log
}}}
```
== Install the "plist" file ==
## Install the "plist" file
This is the file that will instruct the operating system to launch Tor on boot.
This is the file that will instruct the operating system to launch Tor on boot.
...
@@ -93,7 +93,7 @@ You must carefully:
...
@@ -93,7 +93,7 @@ You must carefully:
* if any of the optional keys aren't implemented in your version of launchd, please remove them. The essential keys are Label, ProgramArguments, UserName, and RunAtLoad/KeepAlive or the equivalent for your launchd version.
* if any of the optional keys aren't implemented in your version of launchd, please remove them. The essential keys are Label, ProgramArguments, UserName, and RunAtLoad/KeepAlive or the equivalent for your launchd version.
Here is what the file contents look like.
Here is what the file contents look like.
{{{
```
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plistversion="1.0">
<plistversion="1.0">
...
@@ -141,69 +141,69 @@ Here is what the file contents look like.
...
@@ -141,69 +141,69 @@ Here is what the file contents look like.
<!-- If any keys are not implemented in your version of OS X, please feel free to delete them -->
<!-- If any keys are not implemented in your version of OS X, please feel free to delete them -->
</dict>
</dict>
</plist>
</plist>
}}}
```
== Try it out ==
## Try it out
Exit Vidalia if you're using it.
Exit Vidalia if you're using it.
Start a second Terminal window. The sudo commands will challenge you for an administrator password.
Start a second Terminal window. The sudo commands will challenge you for an administrator password.
One you know Tor is running, start Vidalia again. It should connect to the existing Tor process. You should not be challenged for a password.
One you know Tor is running, start Vidalia again. It should connect to the existing Tor process. You should not be challenged for a password.
= Debugging =
# Debugging
Keep an eye on /var/log/system.log.
Keep an eye on /var/log/system.log.
If Tor is running after a reboot, but you see errors in the system log about access, you may need to configure your router to open the Tor ports. Vidalia may have used UPNP or something similar to open the ports on your router, but now you aren't running Vidalia when for starts.
If Tor is running after a reboot, but you see errors in the system log about access, you may need to configure your router to open the Tor ports. Vidalia may have used UPNP or something similar to open the ports on your router, but now you aren't running Vidalia when for starts.
= Running as a different user =
# Running as a different user
You will know if you have the necessary unix admin skills to set this up. You will have to configure Tor to use a network socket rather than a unix domain socket for Tor control - the Tor executable will not allow you to have a unix domain socket that more than one user can access.
You will know if you have the necessary unix admin skills to set this up. You will have to configure Tor to use a network socket rather than a unix domain socket for Tor control - the Tor executable will not allow you to have a unix domain socket that more than one user can access.