🖼️ Problem Overview
If you’re developing a WordPress site locally on macOS using XAMPP, you might encounter this frustrating error while uploading media:
“Unable to create directory wp-content/uploads/2025/10. Is its parent directory writable by the server?”
This issue appears when WordPress doesn’t have permission to create or write to the uploads directory inside the wp-content folder.
Let’s walk through the cause, diagnosis, and step-by-step fix.
🔍 Step 1: Understanding the Cause
WordPress saves uploaded images and files inside:
/wp-content/uploads/[year]/[month]
If WordPress cannot:
create these folders, or
write files into them
you’ll get this permission error.
The root cause on macOS (especially when using XAMPP) is usually incorrect file ownership or permissions — the web server process runs as a different user than your macOS login.
⚙️ Step 2: Identify the Web Server User
First, we need to find out which user the Apache web server runs as.
Open Terminal and run:
ps aux | grep httpd
You’ll see output similar to this:
_tempuser 4121 0.0 0.0 410724400 1424 s000 S+ 7:01PM 0:00.00 grep httpd
daemon 4069 0.0 0.0 34476672 3488 ?? S 7:00PM 0:00.01 /Applications/XAMPP/xamppfiles/bin/httpd ...
root 4023 0.0 0.1 34476672 14940 ?? Ss 7:00PM 0:00.14 /Applications/XAMPP/xamppfiles/bin/httpd ...
Here, daemon is the key user — that’s the account running Apache under XAMPP on macOS.
🧰 Step 3: Fix File Ownership and Permissions
Navigate to your WordPress project folder inside XAMPP’s htdocs directory.
Example:
cd /Applications/XAMPP/xamppfiles/htdocs/mywordpress
Then give ownership and permissions to the correct web server user:
sudo chown -R daemon wp-content/uploads
sudo chmod -R 775 wp-content/uploads
Explanation:
chown changes ownership to the Apache user (daemon).
chmod 775 allows both the owner and group to write, while everyone else can read.
If you want to apply this to the whole wp-content folder (recommended for local dev):
sudo chown -R daemon wp-content
sudo chmod -R 775 wp-content
🔁 Step 4: Restart Apache
Restart Apache from the XAMPP Control Panel or run this command:
sudo /Applications/XAMPP/xamppfiles/xampp restartapache
Then reopen your browser and try uploading an image again from Media → Add New in your WordPress dashboard.
✅ It should now upload successfully!
🧾 Step 5: Check PHP Upload Configuration (Optional but Important)
If uploads still fail or get stuck, the issue may be with your PHP upload settings.
Create a file named phpinfo.php in your WordPress directory:
<?php phpinfo(); ?>
Open it in your browser:
http://localhost/phpinfo.php
Check for these key values:
Setting Description Recommended
file_uploads Enables uploads On
upload_tmp_dir Temporary upload directory Should have a valid path
upload_max_filesize Max size of a single file 64M (or higher)
post_max_size Max size for total POST data 128M (or higher)
If upload_tmp_dir is empty, edit your PHP config file:
sudo nano /Applications/XAMPP/xamppfiles/etc/php.ini
Uncomment or add this line:
upload_tmp_dir = "/Applications/XAMPP/xamppfiles/temp"
Then restart Apache again:
sudo /Applications/XAMPP/xamppfiles/xampp restartapache
🧠 Why This Happens
On macOS, each process runs under its own user account.
You (the logged-in developer) are one user.
Apache (from XAMPP) runs as daemon.
When WordPress tries to create directories under your account’s ownership, Apache doesn’t have permission unless explicitly granted.
Hence, the fix is about aligning permissions between you and the web server.
💡 Bonus Tips
Always use relative paths for uploads. Check your wp-config.php and remove any hardcoded UPLOADS definitions like:
define('UPLOADS', '/Users/username/.../wp-content/uploads');
Instead, let WordPress manage it automatically.
Keep wp-content/uploads writable only for local development.
On production servers, consider more restrictive permissions (e.g., 755 with proper ownership).
After fixing the issue, delete the temporary phpinfo.php file for security.
🚀 Final Thoughts
Fixing file upload errors in local WordPress setups is often about understanding how your server runs under the hood.
In macOS + XAMPP environments, simply changing the ownership of your wp-content/uploads directory to the daemon user and ensuring writable permissions resolves the issue immediately.
Once set up properly, you’ll be able to upload themes, plugins, and images without a hitch.
Top comments (0)