Fixing the “Unpacking the package… Could not create directory.” Error in WordPress

Many WordPress users who are using a dedicated or VPS server or are setting up WordPress manually on your hosting provider in Linux or OSX get stuck with plugin installs. WordPress plugin and theme upgrades fail with the error “Unpacking the package… Could not create directory.”. This is mostly due to incorrect permissions and can be fixed easily.

Could not create directory WordPress

To fix this, you need to change the permissions on your plugins and upgrade folder.

The plugins directory is located in <WORDPRESS ROOT>/wp-content/plugins and the upgrade directory is in the same/wp-content/upgrade folder.

You need to change the permissions of both these permissions to 777. You can do this using the following commands from the command line (assuming that you are in the WORDPRESS_ROOT folder):

# cd wp-content # chmod a+w plugins # chmod a+w upgrade
# chmod a+w themes

Once done, you should be able to install your plugins and upgrade your plugins and themes successfully.

In case you are using a graphical tool to set permissions, you need to set permissions of the plugins and upgrade folders to Read, Write, Execute for user group and world (all users).

Pro Tip: Some plugins like W3 Total Cache require access to other files and folders. In my case, it was needed to create two folders in the wp-content directory and make changes to the wp-config.php and .htaccess files. In this case, you should temporarily change the permissions of the folders where the plugin is trying to create and modify files to 777 using the same commands above.

Pro Tip: Install the plugin but remember to change the permissions back to their original value as changing permissions of critical WordPress files to 777 may expose your site to security risks and leave it vulnerable to hackers. The safest solution is to add apache to the same group as the owner of the WordPress installation and change all group permissions to writeable. The commands just to give the group members write permissions are:

# cd wp-content # chmod g+w plugins # chmod g+w upgrade
# chmod g+w themes

Let us know if you found this article useful using the comments below and whether it helped you resolve the “Unpacking the package… Could not create directory.” error in WordPress.

Comment Policy: Comments adding value to the article are encouraged. Relevant links will be allowed in such comments.
If you think that you have a link that adds value to this article please contact us at techie[at]techzog[dot]com for evaluation of inclusion into the article.
Comments left solely for spamming links will be deleted. Thank you for understanding.

3 thoughts on “Fixing the “Unpacking the package… Could not create directory.” Error in WordPress

  1. The error I was getting was : “Unpacking the package… Could not create directory.”

    sudo chmod -R 777 /Applications/XAMPP/xamppfiles/htdocs/

    This above code worked for me on local host to install a plugin. I had just installed a paid WordPress theme and wanted to install plugins using localhost on xampp

  2. Thank you varun! this helped me a lot.
    thank you also for giving information for resetting the wp-content folder.
    there are several informations in google, only this helped me.

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge

This site uses Akismet to reduce spam. Learn how your comment data is processed.