This tutorial assumes you have already set up your mac to use your httpd-vhosts.conf file and have MySQL and PHP running.  Also, if you run into an error that says you need mcrypt, try following this tutorial on How to Install mcrypt for php on Mac OSX Lion 10.8 & 10.7 Development Server (it also works for 10.9).

This was written using Mac OSX 10.9 “Mavericks” with Magento EE 1.11.0.2, PHP v5.4.17, MySQL v5.6.10 and Apache 2.2.24.

1. Create Database

If you are using Sequel Pro, connect to your localhost and create a database by going to to the database dropdown and pick “Add Database…”, give it a name and click “Add”

2. Create a directory for the files

Create a directory wherever you are storing your localhost sites.  For the purpose of this tutorial we will use ~/Sites/magento

3. Setup your Virtual Host

Open up your hosts file (/private/etc/hosts) in your text editor and add the line…

127.0.0.1    magento.dev

(you can change “magento.dev” to the domain of your choosing, just avoid ending it in “.local” since Mac uses that for other things)

Then open up your vhosts file (/private/etc/apache2/extra/httpd-vhosts.conf) and add this to the bottom…

	<VirtualHost *:80>
		DocumentRoot "/Users/YOU/Sites/magento">
		ServerName magento.dev
		ErrorLog "/Users/YOU/Sites/Logs/magento.dev-error_log"
		CustomLog "/Users/YOU/Sites/Logs/magento.dev-access_log" common
		<Directory />
			Options FollowSymLinks
			AllowOverride All
		</Directory>
	</VirtualHost>

(feel free to organize your ErrorLog and CustomLog anyway you wish, just make sure whatever directory you want to put them in actually exists otherwise your site will error out)

4. Install Sample Data (optional)

If you are using this magento install for testing, having some existing data in place can help speed things up.  To install, make sure to do this BEFORE you go through the Magento install wizard.

Download sample data at http://www.magentocommerce.com/download

This will give you a SQL file and a media directory.  Replace the ~/Sites/magento/media directory with the one from the sample data, then import the SQL file into your new database you set up in Step 1.

5. Set File Permissions to Writable

Open up the Terminal application on your Mac and enter the following commands. These will set the owner and group of the file to apache (depending on your apache install you may need to change _www with whatever you install uses for the apache user). This also add group write access to all files and folders which is necessary for your user account on your mac to be able to modify files.

    sudo chown -R _www:_www /path/to/magento
    sudo chmod -R g+w /path/to/magento

If you haven’t already you will also want to add your current computer user to the apache group so you don’t have any trouble editing the files. Replace “yourusername” with your actual computer user name.

    sudo dseditgroup -o edit -a yourusername -t user _www

To verify what your user name is you can open up Terminal and your username should be right before the dollar sign (ex: “macbook:~ yourusername$”) or you can…

  1. Open “System Preferences”
  2. Click “Users & Groups”
  3. Right click on your user from the list at the left
  4. Click “Advanced Options…”
  5. Your user name will be listed under “Account name”

Quick Alternative: If you don’t want to deal with all that just yet and just want to install on your local, you can just force the necessary directories to writeable.  This is not recommended for site accessible on the web due to security concerns, though.

    sudo chmod -R 777 ./app/etc/ ./var/ ./media/

6. Run Magento Install Wizard

Access your new Magento files via your browser using http://magento.dev (or whatever you decided to call it).  This will walk you through the steps.  If you encounter an error, check the list of possible errors and solutions below that may help you.

7. Secure Your Install (optional)

If you are running this on your localhost for development or testing purposes this part isn’t so critical, but in general to secure your install follow this guide… http://www.magentocommerce.com/knowledge-base/entry/install-privs-after

Solutions to Possible Errors

PHP Extensions “0” must be loaded.

Replace <pdo_mysql/> with <pdo_mysql>1</pdo_mysql> in your file ~/Sites/YOU/magento/app/code/core/Mage/Install/etc/config.xml around line #72.

(Solution from http://www.magentocommerce.com/boards/viewthread/284882/)

Database server does not support the InnoDB storage engine.

Line 59 of the file app/code/core/Mage/Install/Model/Installer/Db/Mysql4.php

Replace

    public function supportEngine()
    {
        $variables  = $this->_getConnection()
            ->fetchPairs('SHOW VARIABLES');
        return (!isset($variables['have_innodb']) || $variables['have_innodb'] != 'YES') ? false : true;
    }

With

    public function supportEngine()
    {
        $variables  = $this->_getConnection()
            ->fetchPairs('SHOW ENGINES');
        return (isset($variables['InnoDB']) && $variables['InnoDB'] != 'NO');
    }

(Solution from: http://stackoverflow.com/questions/15443448/magento-complains-missing-innodb-when-it-is-available)

Database Connection Error

Open up Terminal and check to see if you can see the status of your mysql database with

    mysql status

You might get the error: “ERROR 2013 (HY000): Lost connection to MySQL server at ‘sending authentication information’, system error: 32”. If so, try stopping and restarting MySQL Server…

    sudo /usr/local/mysql/support-files/mysql.server stop
    sudo /usr/local/mysql/support-files/mysql.server start
0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Robert Sullivan
7 years ago

I followed this and had my work accomplished. Thankyou.

Mischa
Mischa
5 years ago

It could not find any styles, so i guessed the theme was somehow missing.
I had to do: php bin/magento setup:static-content:deploy
to get the styles and the site working 🙂

tanx for you tutorial 🙂