require 'formula' class Tor < Formula url 'https://www.torproject.org/dist/tor-0.2.2.35.tar.gz' homepage 'https://www.torproject.org/' md5 'dcecf699c4b929319d5f1ce0358d4835' depends_on 'libevent' def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}" system "make install" (prefix+'org.tor.plist').write startup_plist (prefix+'org.tor.plist').chmod 0644 end def startup_plist return <<-EOPLIST Label org.tor RunAtLoad KeepAlive UserName #{`whoami`.chomp} ProgramArguments #{bin}/tor WorkingDirectory #{HOMEBREW_PREFIX} EOPLIST end def caveats; <<-EOS.undent You can start tor automatically on login with: mkdir -p ~/Library/LaunchAgents cp #{prefix}/org.tor.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/org.tor.plist EOS end end