Programmatically 'auto hide menubar' in El capitan
Here's how you can set the menubar to be hidden and unhidden using defaults:

To hide:

defaults write NSGlobalDomain _HIHideMenuBar -bool true


To show:

defaults write NSGlobalDomain _HIHideMenuBar -bool false


Once run, logout and log back in. Alternatively, you can run the following command as the logged-in user to restart Finder and show the changes:

killall Finder