Fixing Permissions for WordPress to Update/Upgrade

Activated a new theme on my wordpress install on localhost. I had to make these changes:

1. follow the instructions: http://www.hongkiat.com/blog/update-wordpress-without-ftp/
2. Change the permissions for the wp-content and plugins folders:
sudo chmod 777 Your_wordpress_root_folder/wp-content
sudo chmod 777 Your_wordpress_root_folder/wp-content/plugins

3. Install the plug-in, it should work fine.
To change back the permission for protecting the wordpress contents and plug-in, otherwise you can leave it as is if the security is not a big concern :
4. change back the original permission :
sudo chmod 751 Your_wordpress_root_folder/wp-content
sudo chmod 751 Your_wordpress_root_folder/wp-content/plugins

Found the fix here:
https://wordpress.org/support/topic/core-or-plugin-update-could-not-create-directory-httpdocs#post-5602273