Whenever you install a new extension or changes some class constructor, you have to recompile the magento. After compilation some new cache and generation files are generated inside var directory, you need to set recursive permission every time.
Navigate to the installed Magento installed directory use the following steps to re-compile.
Remove earlier data
1. sudo rm -rf var/di var/generation var/cache
Run the following command if you are installing new extension