Drupal - Prevent directory permissions of sites/default from being protected in a local environment?
If you are on Drupal 8, you can configure settings.php to include a settings.local.php with a simple environment check (to ensure you are running a local env).
In that file, you can add this:
$settings['skip_permissions_hardening'] = TRUE;
This will allow you to open and write to settings.php without it being locked back down.