civix permission denied errors in /usr/local/bin when generating a skeltal extension
My read on this error doesn't suggest it's trying to write to /usr/local/bin/civix - just that the files that are calling mkdir() and file_put_contents() are located there.

If you call civix to generate a module, it will create it in the current working directory.  Check the permissions of the current directory.  If that's not conclusive, you can update the question.