Can't install plugin and theme
After a clean install of Wordpress locally, add below statement
define("FS_METHOD", "direct");
to my wp-config.php file.
Later change the ownership of the wp-content and the contents inside the wp-content folder to the web server user (_www) I used the below commands.
sudo chown _www:_www wp-content
sudo chown _www:_www wp-content/*
Alternatively you can also set the permission recursively using
sudo chown -R _www:_www wp-content/
It complains about FTP credentials when it cannot access the filesystem.
Most likely your permissions are wrong (directory inaccessible by webserver)
If you ensure that your wordpress directory is owned by the same user who runs your webserver, the FTP credentials note should disappear and you should be able to install themes and plugins via Wordpress Admin console.