Fixing WordPress Update and File Permission Errors on Localhost
Content
If you're developing WordPress locally, you've likely encountered the frustrating "Update Failed: Could not create directory" or "inconsistent file permissions" error. These issues are among the most common hurdles for developers working in local environments like XAMPP, Local by Flywheel, Docker, or native server stacks on Windows, macOS, and Linux.
This guide will walk you through the root causes of these permission and update failures and provide the most effective solutions, compiled from community troubleshooting.
Why Do These Errors Happen?
WordPress needs write access to specific directories to perform updates, install plugins/themes, and create files. When it can't, it throws these errors. The core issue is almost always a mismatch between the user account that owns the files and the user account that your web server software (Apache, nginx, IIS) runs under. On local setups, this is frequently complicated by:
- Fresh operating system upgrades (e.g., macOS Catalina)
- Security software (e.g., Sophos, SELinux)
- File ownership changes after moving project folders
- Extended file attributes (ACLs, xattr) or quarantine flags on macOS
- Docker container permission mapping issues
- Incorrect permission definitions in
wp-config.php
Common Solutions to Try
1. Verify and Correct File Permissions
The standard permission model for WordPress is 755 for directories and 644 for files. You can set these recursively from your WordPress root directory. Note: Using 777 is a common quick fix but is not recommended for anything other than temporary local development due to security risks.
On Linux/macOS (Terminal):
find /path/to/your/wordpress/install -type d -exec chmod 755 {} ;
find /path/to/your/wordpress/install -type f -exec chmod 644 {} ;
On Windows (File Explorer):
Right-click the wp-content directory, select 'Properties', go to the 'Security' tab, and ensure that the user account running your web server (e.g., www-data for XAMPP) has 'Full control' or at least 'Modify' and 'Write' permissions. Apply these changes to all child objects.
2. Check File and Folder Ownership
Permissions are useless if the web server process does not own the files or is not part of the owning group. Identify the user your web server runs as (e.g., www-data, daemon, apache) and change ownership accordingly.
On Linux/macOS (Terminal):
# Change ownership to the web server user (common user is 'www-data') sudo chown -R www-data:www-data /path/to/your/wordpress/install
3. Configure wp-config.php for Direct Filesystem Access
If your permissions and ownership are correct but the error persists, explicitly define the filesystem method in your wp-config.php file. Add the following line above the /* That's all, stop editing! Happy publishing. */ comment:
define('FS_METHOD', 'direct');
Warning: This directive is generally safe for local development but should be used with extreme caution or avoided on live, production servers as it can be a security risk.
4. Investigate macOS-Specific Issues (xattr, Quarantine)
Downloads on newer versions of macOS are often tagged with a quarantine extended attribute. This can prevent WordPress from using the files. Navigate to your WordPress download directory (often ~/Downloads or /tmp) and run this command on the downloaded ZIP file before attempting a manual update:
xattr -c /path/to/downloaded/wordpress.zip
5. Temporarily Disable Security Software
Security modules like SELinux (Linux) or third-party antivirus software can intercept and block file write operations even if permissions appear correct.
- SELinux: Temporarily set it to permissive mode with the command
sudo setenforce 0to test if it is the cause. Remember to reconfigure it properly instead of leaving it disabled. - Antivirus: Try temporarily disabling your antivirus software to see if it is blocking file operations. If it is, add an exception for your local web server directory.
6. For Docker Users (wp-env)
Docker-related issues often stem from the host machine's Docker daemon or image cache.
- Try a simple restart:
docker-compose downfollowed bydocker-compose up -d. - Prune unused images and volumes:
docker system prune -a(be careful, this will remove all unused images, not just WordPress ones). - Ensure your project directory is properly mounted and not affected by strict user mapping in the Docker compose file.
7. When All Else Fails: Manual Update
If automated updates continually fail, a manual update is a reliable fallback. The 'Localhost Installs' team suggests following the official WordPress manual update guide. This involves downloading the latest version of WordPress, extracting it, and manually replacing files via SFTP/FTP or your file manager.
Conclusion
File permission and update issues on localhost are a rite of passage for WordPress developers. The solution almost always involves aligning file permissions and ownership with your web server's user. By methodically working through the solutions above—starting with permissions and ownership, then moving to configuration and security software—you can resolve these errors and get back to building.
Related Support Threads Support
-
“Update Failed: Could not create directory” error, but folders set to 755https://wordpress.org/support/topic/update-failed-could-not-create-directory-error-but-folders-set-to-755/
-
Updating WP Core Fails On Local Installhttps://wordpress.org/support/topic/updating-wp-core-fails-on-local-install/
-
Update from 6.7.2 to 6.8.1 Fails, Progressive Problemhttps://wordpress.org/support/topic/update-from-6-7-2-to-6-8-1-fails-progressive-problem/
-
Updating WordPress Versionhttps://wordpress.org/support/topic/updating-wordpress-version-4/
-
wp-env start command stuck at “Updating docker images.”https://wordpress.org/support/topic/wp-env-start-command-stuck-at-updating-docker-images/
-
Cannot create directory (plugin no longer updateable on LOCAL)https://wordpress.org/support/topic/cannot-create-directory-plugin-no-longer-updateable-on-local/
-
Update Failed, Permission Deniedhttps://wordpress.org/support/topic/update-failed-permission-denied/
-
Localhost WordPress instalhttps://wordpress.org/support/topic/localhost-wordpress-instal/
-
filesystem write requirementshttps://wordpress.org/support/topic/filesystem-write-requirements/
-
IIS install: inconsistent file permissions.: wp-admin/includes/update-core.phphttps://wordpress.org/support/topic/iis-install-inconsistent-file-permissions-wp-admin-includes-update-core-php/
-
Update failed.: The checksum of the filehttps://wordpress.org/support/topic/update-failed-the-checksum-of-the-file/
-
Plugin upload to installhttps://wordpress.org/support/topic/plugin-upload-to-install-2/
-
Docker Desktop and wordpress-develop | Unable to generate new wp-confighttps://wordpress.org/support/topic/docker-desktop-and-wordpress-develop-unable-to-generate-new-wp-config/
-
WP on XAMPP Windows – “The upgrade directory exists but is not writable.”https://wordpress.org/support/topic/wp-on-xampp-windows-the-upgrade-directory-exists-but-is-not-writable/
-
The update could not be unpacked on localhost Mojavehttps://wordpress.org/support/topic/the-update-could-not-be-unpacked-on-localhost-mojave/
-
Help verifying if my directory permissions and ownerships are correcthttps://wordpress.org/support/topic/help-verifying-if-my-directory-permissions-and-ownerships-are-correct/
-
Issue with docker image for wp-env?https://wordpress.org/support/topic/issue-with-docker-image-for-wp-env/
-
wp-env: Error: ‘wp-config.php’ not found.https://wordpress.org/support/topic/wp-env-error-wp-config-php-not-found/
-
write problem for plugins on win10 / localhosthttps://wordpress.org/support/topic/write-problem-for-plugins-on-win10-localhost/
-
Unable to update to 5.9.2https://wordpress.org/support/topic/unable-to-update-to-5-9-2/
-
Unable to update local installationhttps://wordpress.org/support/topic/unable-to-update-local-installation/
-
WordPress on localhost says “UPDATING FAILED” on page updatehttps://wordpress.org/support/topic/wordpress-on-localhost-says-updating-failed-on-page-update-2/
-
Permissions and Updating Error on Fedora 33https://wordpress.org/support/topic/permissions-and-updating-error-on-fedora-33/
-
wordpress NO funciona correctamente!!!https://wordpress.org/support/topic/wordpress-no-funciona-correctamente/
-
Warning: chmod(): Operation not permitted in /wp-admin/includes/class-wp-filesyshttps://wordpress.org/support/topic/warning-chmod-operation-not-permitted-in-wp-admin-includes-class-wp-filesys/