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