Magento 2 installation guide for Mac OS High Sierra

1. php7, mysql 5.6+, apache2 are required to install Magento 2. Those should have been installed already in Mac OS High Sierra.

2. cd into a directory where you want to place the Magento 2 installation, this composer command below will create a directory called Magento 2 and download all the base code into this directory. It will ask you for credentials, go to https://account.magento.com/customer/account/ to create an account if you don’t have one, and then login -> My Profile -> Marketplace -> Access Keys

cd 
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2

3. Create a apache httpd config file for hosting Magento 2 locally on your machine, the file name can be httpd_magento2.conf and put the following in it, the file can be placed in the magento2 folder.

#This conf is included in the /etc/apache2/httpd.conf file
#
Listen 88


    DocumentRoot "/replace/this/with/your/magento2/root/folder/path"



    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    
    Order allow,deny
    Allow from all
    
    = 2.4>
    Require all granted
    
    RewriteEngine On

4. Open apache httpd config file located in /etc/apache2/httpd.conf, and add this line to include the above httpd config file for the Magento 2.

Include /replace/this/with/your/magento2/root/folder/path/httpd_magent2.conf

5. Restart apache2 server for the above httpd configuration changes.

sudo apachectl restart

6. In your magento2 folder, run the following command in order. _www is the username of apache server. On a production server, for security reasons, it’s better to create a user for mangento2 and add that user to the apache2 user group, and grant that group the access to the magento2 file system.

cd 
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
sudo chown -R :_www .
chmod u+x bin/magento

7. Open this url on a browser, and a setup wizard shall be presented.

http://localhost:88/

8. Check for readiness.

9. Install mcrypt and intl if it hasn’t installed yet on your mac os.

sudo port -v selfupdate
sudo port install php71-mcrypt
sudo port install php71-intl

10. Open /etc/php.ini and append this line to it. Replace no-debug-non-zts-20160303 with yours. If the php.ini does not exist, create it by copy from /etc/php.ini.default

extension=/opt/local/lib/php71/extensions/no-debug-non-zts-20160303/mcrypt.so
extension=/opt/local/lib/php71/extensions/no-debug-non-zts-20160303/intl.so

11. Comment out this line in the php.ini file.

pdo_mysql.default_socket=

12. Restart apache server

sudo apachectl restart

13. Create a database called magento in mysql.

mysql
create database magento;

14. Go back to the web browser, in the add database step, change localhost to

127.0.0.1

15. For local development the username and password can just be magento magneto2, and the admin url can be just localhost/admin

16. On Mac High Sierra, the pre-installed php did not compiled with freetype. And you will get error Image CAPTCHA requires FT fonts support when trying to log into the magento admin localhost/admin. To get pass this, open the vendor/zendframework/zend-captcha/src/Image.php, and update the constructor to this:

/**
 * Constructor
 *
 * @param  array|\Traversable $options
 * @throws Exception\ExtensionNotLoadedException
 */
public function __construct($options = null)
{
    parent::__construct($options);
    return;

    if (! extension_loaded("gd")) {
        throw new Exception\ExtensionNotLoadedException("Image CAPTCHA requires GD extension");
    }

    if (! function_exists("imagepng")) {
        throw new Exception\ExtensionNotLoadedException("Image CAPTCHA requires PNG support");
    }

    if (! function_exists("imageftbbox")) {
        throw new Exception\ExtensionNotLoadedException("Image CAPTCHA requires FT fonts support");
    }
}

Or reinstall the php using brew, and update the apache httpd.conf to use the php from brew instead of the one provided by Mac OS.

#reinstall php
brew remove --ignore-dependencies --force php70 php71 php72
brew install php71 --with-freetype
brew info php71

#update the /etc/httpd.conf to use the php from brew
LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so

Installed code base in Github
Official installation guide:
https://devdocs.magento.com/guides/v2.2/install-gde/bk-install-guide.html

Search within Codexpedia

Custom Search

Search the entire web

Custom Search