Xcode

Install xcode, it's required for other programs

xcode-select --install

Homebrew

Install Homebrew

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Check if Homebrew is correctly installed

arch -x86_64 brew doctor

Install usefull packages

arch -x86_64 brew install redis sqlite wget 

Start redis service

arch -x86_64 brew services start redis

To prevent "permission denied" with brew

sudo chown -R "$USER":admin /usr/local

Cocoapods

Install Cocoapods

arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
###### Install ffi
arch -x86_64 sudo gem install ffi

Install zsh

arch -x86_64 brew install zsh

Install Oh My Zsh, type "Y" to confirm to change the defaukt shell to zsh

arch -x86_64 sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Tell the system to use programs installed by Hombrew (in /usr/local/bin) rather than the OS default if it exists.

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc

Packages

zsh-syntax-highlighting

Install zsh-syntax-highlighting

arch -x86_64 brew install zsh-syntax-highlighting 

To activate the syntax highlighting, enter this command to update the .zshrc file:

echo 'source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc

You will also need to force reload of your .zshrc:

source ~/.zshrc

zsh-autosuggestions

Install zsh-autosuggestions

arch -x86_64 brew install zsh-autosuggestions 

To activate the autosuggestions, enter this command to update the .zshrc file:

echo 'source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc

You will also need to force reload of your .zshrc:

source ~/.zshrc

Themes

Edit your .zshrc, find the key ZSH_THEME. By default it is "robbyrussell", change with :

ZSH_THEME="ys"
To disable strange warning,
nano ~/.zshrc
Set this line at top of file:
ZSH_DISABLE_COMPFIX=true
Save and relaunch terminal

Git and Github

Install git

brew install git

Define your Git user (should be the same name and email you use for GitHub)

git config --global user.name "FirstName LastName"
git config --global user.email "your.email@cegelem.fr"

MySQL

Install MySQL 8.0

brew install mysql@8.0

To have MySQL started now and auto restarted at login

brew services start mysql@8.0

Setup MySQL

# 0 - mysql_secure_installation
# 1 - n
# 2 - toor
# 3 - toor
# 4 - y
# 5 - y
# 6 - y
# 7 - y
mysql_secure_installation

Node

Install Node LTS

brew install node@12

Tell the system where npm is installed

echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.zshrc

You will also need to force reload of your .zshrc:

source ~/.zshrc

Install Font Awesome Pro

npm config set "@fortawesome:registry" https://npm.fontawesome.com/ && npm config set "//npm.fontawesome.com/:_authToken" 70FD2A39-6862-4A64-8284-82FB1564B4DE

PHP

PHP 7.4

Install PHP 7.4

brew install php@7.4

To have PHP started now and auto restarted at login

brew services start php@7.4

Check PHP version

php -v
PHP 7.4.4 (cli) (built: Mar 19 2020 20:12:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.4, Copyright (c), by Zend Technologies

The php.ini and php-fpm.ini file can be found in /usr/local/etc/php/7.4/

Update default PHP-FPM

Update default PHP-FPM configuration via /usr/local/etc/php/7.4/php-fpm.d/www.conf

pm = dynamic
pm.max_children = 200
pm.start_servers = 20
pm.min_spare_servers = 10
pm.max_spare_servers = 20
pm.process_idle_timeout = 10s
pm.max_requests = 500

Xdebug 2.9

Install Xdebug 2.9

pecl install xdebug-2.9.4

Check PHP version with Xdebug installed

php -v
PHP 7.4.4 (cli) (built: Mar 19 2020 20:12:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v2.9.4, Copyright (c) 2002-2020, by Derick Rethans
    with Zend OPcache v7.4.4, Copyright (c), by Zend Technologies

Toggle Xdebug 2.9

Toggle x-debug extension : vim /usr/local/etc/php/7.4/php.ini and comment / uncomment zend_extension="xdebug.so" line.

PHPRedis

Install PHPRedis

pecl install redis
# ...
# enable igbinary serializer support? [no] : no
# enable lzf compression support? [no] : no
# ...

Check if extension is enabled

cat /usr/local/etc/php/7.4/php.ini | grep redis
# extension="redis.so"

Composer

Install latest composer version

brew install composer

Tell the system where composer is installed by replacing your system user name.

echo 'export PATH="/Users/YOUR_SYSTEM_USER_NAME/.composer/vendor/bin:$PATH"' >> ~/.zshrc

You will also need to force reload of your .zshrc:

source ~/.zshrc

Packages

Install useful packages

composer global require laravel/valet tightenco/lambo phpunit/phpunit laravel/installer

Install valet

valet install

Add sudoers files for Brew and Valet to make Valet commands run without passwords

valet trust

Git repositories

ad-old

Setup valet :

  • need laravel/valet to be installed first
  • cd /to/ad-old/git/repository
  • enter the command below
valet link ad-old && valet secure ad-old

Alias

These aliases only work with ZSH terminal.

Laravel

echo 'alias art="php artisan"' >> ~/.zshrc

Repositories

# ad-old
echo 'alias adold="cd ~/Codes/Cegelem/ad-old"' >> ~/.zshrc

SSH

If you need to access to servers, you will find below a usefull set of aliases.

For production

# ad-old
echo 'alias adold-production="ssh forge@35.180.132.237 -i ~/.ssh/laravel_forge_cegelem"' >> ~/.zshrc

For staging

# ad-old
echo 'alias adold-staging="ssh forge@52.47.189.116 -i ~/.ssh/laravel_forge_cegelem"' >> ~/.zshrc

Misc

# composer i
echo 'alias ci="composer i"' >> ~/.zshrc

# composer i && npm i && npm run dev echo 'alias cinidev="composer i && npm i && npm run dev"' >> ~/.zshrc

# composer i && npm i && npm run prod echo 'alias ciniprod="composer i && npm i && npm run prod"' >> ~/.zshrc

</div>