It might be quite easy to disable asking for ftp credentials on localhost while installing themes and plugins but if you don’t know the solution, this take you in real headache.
When you try to install / upgrade themes/plugins, in a while you’ll meet up with a WordPress install that requires you to put your FTP username and password. This means normally our local server asks you to look at file permissions, specifically tweak your upload directory or some such thing.
I’ve faced same problem many times and I tried to sort out making files writeable. But this idea doesn’t help.The better solution that I’ve found to stop FTP installation / updates on WordPress is to add the following line into your wp-config.php file:
define('FS_METHOD','direct'); // stop asking ftp credentials on theme/plugins installations