Accidentally changed owner of /var system folder recursively to myself

Solution 1:

Since the system isn't bootable (in the normal sense), one easy way forward is to boot to Recovery HD and re-install the OS. There are thousands of files in /private/var that should be owned by root:wheel, _softwareupdate:_softwareupdate, myusername:staff, and hundreds root:admin so carpet bombing one ownership across the directories might lead to even worse breakage.

A reinstallation won't delete anything in the user and application folders but it also may or may not work - depending on if it moves aside /private and makes a new one or if it runs the equivalent of sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume / which is a way to "repair permissions" on El Capitan if you managed to get things running again. If you have a recent backup, you could always just erase and reinstall from that.

I would try this as a first step to see if your system is salvageable. The repair_packages tool will run in single user mode, so that might be a nice thing to try after mounting / as read write (the syntax is provided when you boot). That tool used to be something you could run from Disk Utility, but now it's a command line tool for more specialized use apparently.