Setup Dev Environment on Mac OS
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
export PATH="/opt/homebrew/bin:$PATH"
brew install wget composer node gnu-tar gpatch git
Install drush on mac:
cd ~/Downloads
wget https://github.com/drush-ops/drush/releases/download/8.4.9/drush.phar
sudo chmod +x drush.phar
sudo mv drush.phar drush
sudo mv drush /usr/local/bin
MAC install drush:
composer global require drush/drush:8.4.9
export PATH="$HOME/.composer/vendor/bin:$PATH"
chmod +x drush.phar
curl -OL https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
sudo mv drush.phar /usr/local/lib/drush
sudo nano ~/.zshrc
and append this line:export DRUSH_LAUNCHER_FALLBACK=~/.composer/vendor/bin/drush
pecl install xdebug-3.2.2
(newer versions have bug)
brew install composer
brew install node
brew install gnu-tar
brew install gpatch
brew install mariadb
brew install nginx
brew install node@14
brew unlink node
brew link node@14
brew link --force --overwrite node@14
echo 'export PATH="/opt/homebrew/opt/node@14/bin:$PATH"' >> ~/.zshrc
npm rebuild node-sass
The default port has been set in /opt/homebrew/etc/nginx/nginx.conf to 8080 so that
nginx will load all files in /opt/homebrew/etc/nginx/servers/.
To start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/nginx/bin/nginx -g daemon\ off\;
brew install shivammathur/php/php@7.4
brew install shivammathur/php/php@8.1
brew install shivammathur/php/php@8.2
brew tap shivammathur/extensions
brew install imap@7.4
brew install imap@8.1
brew unlink php && brew link --overwrite --force php@7.4
brew unlink php && brew link --overwrite --force php@8.1
sudo nano /opt/homebrew/etc/php/8.1/php.ini
php.ini changes:
max_execution_time = 300
max_input_time = 600
max_input_vars = 2000
memory_limit = 512M
post_max_size = 512M
upload_max_filesize = 512M
to have different versions of php change listen port in file
/opt/homebrew/etc/php/7.4/php-fpm.d/www.conf
listen = 127.0.0.1:9074
brew install shivammathur/extensions/mcrypt@7.4
then you install mcrypt with same version as php version
brew install mcrypt@7.4
On MAC if permission denied
stat() "/Users/dmitry/www/AF2/web/" failed (13: Permission denied)
You need to ensure you have +x on all of the directories in the path leading to the site's root:
chmod +x /Users/dmitry
chmod +x /Users/dmitry/www
If nginx doesn't work:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
To restart nginx after an upgrade:
brew services restart nginx
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/nginx/bin/nginx -g daemon off;
Reset all extended attributes for a single file:
sudo xattr -c <filepath>
Reset all extended attributes recursively:
sudo xattr -rc <directory>
sudo chmod -R -N <directory>
Drush workaround:
curl -OL https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar
chmod +x drush.phar
sudo mv drush.phar /usr/local/drush
brew install pcre2
ln -s /opt/homebrew/opt/pcre2/include/pcre2.h /opt/homebrew/opt/php@8.1/include/php/ext/pcre/
pecl install apcu
Edit with gui editor:
sudo open -a TextEdit /opt/homebrew/etc/nginx/servers/af2.conf