I've just installed Magento 2 Community Edition with sample data (downloaded from their website and not installed with composer) locally via MAMP. The installation process was succesful, but all files in the pub/static folder are missing except .htaccess. That means all css, js etc. return 404 for both frontend and backend.

I've spent several hours trying to fix this without luck. This is what I've done so far:

  • Changed Options Indexes FollowSymLinks AllowOverride from 'None' to 'All' in the /MAMP/conf/apache/httpd.conf and restarted MAMP
  • Made sure LoadModule rewrite_module modules/mod_rewrite.so is uncommented in httpd.conf
  • Set up a development domain (magento.dev) in MAMP
  • Tried running php bin/magento setup:static-content:deploy in the magento.dev root using Terminal. This however returns:

Fatal error: Class 'Locale' not found in /Applications/MAMP/htdocs/magento.dev/vendor/magento/framework/Locale/Bundle/DataBundle.php on line 64

  • Uncommented and changed RewriteBase to RewriteBase / in the .htaccess-file in the magento.dev root directory.
  • Set Magento in development mode
  • Clearing the cache manually and running php bin/magento setup:static-content:deploy again

Most guides and forum posts tell me to run: php bin/magento setup:static-content:deploy but I'm not sure, if I'm doing it correctly.

OS: OSX 10.11.2

MAMP version: 3.5

PHP version: 7.0

Apache version: 2.4.16

MySQL version: 5.6.25

Any help would be appreciated.

  • I'm on 2.2.2 installed on CentOS server. Nothing on this page works. To have any styling I must run php bin/magento setup:static-content:deploy -f and wait 80 seconds.
    – Krista K
    Jan 5, 2018 at 19:34

6 Answers 6



I would like you to download Magento 2 zip from magentocommerce.com/download, create new db in phpmyadmin, extract zip in htdocs folder. Install Magento 2 but do not use localhost use in store URL and admin URL. After successful installation DO NOT run magento.

Now we are going to clear / delete caches and sessions of Magento 2. Go to following paths and delete everything:

ROOT > var > cache > *DELETE ALL*
ROOT > var > page_cache > *DELETE ALL*
ROOT > var > session > *DELETE ALL*

When Magento 2 is not in production mode, it will try to create symlinks for some static resources on local server. We have to change that behavior of Magento 2 by going to edit ROOT > app > etc > di.xml file. Open up di.xml in your favorite code editor, find the virtualType name="developerMaterialization" section. In that section below, you will find an item <item name="view_preprocessed" xsi:type="object"> which needs to be modified. You can modify it by changing the following content:




Now last step, also delete old files generated in ROOT > pub > static > DELETE ALL EXCEPT .HTACCESS

I personally tried it on my localhost using MAMP, EasyPHP DevServer, Xampp and Wampp and successfully installed and using Magento 2. For further you can check out this link: Magento 2 CSS and JavaScript not loading from correct folder


Install Composer. Now I would like you to download Magento 2 zip from magentocommerce.com/download, create new db in phpmyadmin, extract zip in htdocs folder. Install Magento 2 but do not use localhost use in store URL and admin URL. After successful installation DO NOT run magento.

Now we are going to verify Composer installation, Deploy static content, clear / flush Magento cache and reindex the Magento 2 blocks. To perform all above actions, press WINDOWS KEY + R to open RUN dialog and type “cmd” to open Command Prompt.

Type “cd PATH_TO_YOUR_MAGENTO2_FILES” to enter in Magento 2 ROOT directory.

Now to verify Composer installation in above directory, type “composer install”.

If you get any error in this step, please check your Composer installation

In this step, we are setting up static content to deploy on our Magento store. To perform this, type “php bin/magento setup:static-content:deploy”.

If you get any error, check your PHP.EXE and PHP.INI Environment Variable

Clear / Flush Magento cache by typing “php bin/magento cache:flush” in CMD.

And finally, to Reindex Magento Static Blocks type “php bin/magento indexer:reindex”.

You are done with successful installation of Magento 2.

  • Answer has been edited. Jan 18, 2016 at 16:08
  • Greate! I tried the solution 1 and It works for me.. Thanks Khatak sb Jun 1, 2016 at 13:51
  • Welcome @MuhammadAzeem Jun 1, 2016 at 14:05
  • @RajaKhoury You're welcome! Apr 3, 2018 at 15:47
  • Solution 1 works for me! Thank youu very much!! Oct 5, 2018 at 23:44

Try to run below command

php bin/magento setup:static-content:deploy

And if it gives any error while running this command, like file missing as you already said ,then compare your project file structure with fresh magento2 file structure . If any file missing in your project then copy appropriate file into your project.

And if you got any other error then post error in your question so someone can answer your question.

  • Thanks for a quick response. I'll do that. Where exactly and how do I run this command?
    – Skovsgaard
    Jan 5, 2016 at 10:38
  • @Skovsgaard you can run this command from your terminal but make sure that you are in magento2 directory from terminal
    – Keyur Shah
    Jan 5, 2016 at 10:40
  • It seems like no files are missing. The installed Magento obviously contains more files though which are related to the installation process. I get this error: Fatal error: Class 'Locale' not found in /Applications/MAMP/htdocs/magento.dev/vendor/magento/framework/Locale/Bundle/DataBundle.php on line 64 after running php bin/magento setup:static-content:deploy in the root directory.
    – Skovsgaard
    Jan 5, 2016 at 10:58
  • I wasn't really helpful. Sorry.
    – Skovsgaard
    Jan 14, 2016 at 20:41

Looks like intl extension is not loaded in you console version of php. Please verify that you use same version/settings for apache and cli version of php.

MacOsX has preinstalled version of php and some packages that install php do not change symlink for terminal session. As result you can have different version of php installed in same time.

PS: I propose to use vagrant on Mac OS. it is working pretty well if use nfs for file sharing

  • Aha! The preinstalled php (cli) is only 5.5.30. Preinstalled Apache is 2.4.16 (I don't know how to check MAMP's apache-version if MAMP also install Apache separately). So I have to update the preinstalled version to 7 and also install intl extension (cli or mamp?)? Vagrant seem too advanced for a noob like me.
    – Skovsgaard
    Jan 5, 2016 at 11:54
  • I cannot answer Mac-specific questions but there are at least two ways to check your PHP version: php -v (which shows what version PHP commands run as) and using a phpinfo.php, which shows what version of PHP the web server runs. Jan 5, 2016 at 15:22
  • Okay, so MAMP runs PHP 7 and Apache 2.2.29. My local machine runs PHP 5.5.30 and Apache 2.4.16. So next step is to update the local machine's PHP to 7?
    – Skovsgaard
    Jan 6, 2016 at 11:20
  • Please try use full path to php7 binary
    – KAndy
    Jan 6, 2016 at 13:21

If all else fails, prune these directories:

rm -rf pub/static/*    # DO NOT DELETE .htaccess
rm -rf var/view_preprocessed/*
php bin/magento setup:static-content:deploy

This will work if you've got broken symlinks in those dirs.

  • 1
    .htaccess should never be deleted. I also did this mistake and wasted hours Oct 20, 2017 at 14:38

clear page_cache, di ,view_process, cache

then give proper permission to folders and files.

then run php bin/magento setup:static-content:deploy from your root folder.

check pub/static.

I hope this will help you.

  • Where and how do I run clear page_cache, di ,view_process, cache? Its a local installation, so as admin super of my computer I have all permissions read/write permissions. Are there any other permissions I'm not aware of?
    – Skovsgaard
    Jan 5, 2016 at 11:33
  • if you are using local than give full permission to root-folder Jan 5, 2016 at 11:35
  • all folders are in var/ clear all folders and give full permission to folder. Jan 5, 2016 at 11:35

Have you installed composer and run composer init in magento2 directory? If not, try it then run command php bin/magento setup:static-content:deploy

  • Composer is installed on my machine, yes, but I didn't use it for installing Magento 2. I simply just downloaded the .zip from their website, unpacked and installed. If i run composer init composer asks me to set up composer.json config, so I guess that won't help.
    – Skovsgaard
    Jan 6, 2016 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.