MacOS PHP 开发环境配置

MacOS PHP 开发环境配置

Posted by liu kai on October 28, 2019

MacOS PHP 开发环境配置

安装 Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew doctor

确保 brew 运行正常

配置 brew 源

cd "$(brew --repo)" && git remote set-url origin https://git.coding.net/homebrew/homebrew.git

cd $home && brew update

使用 Homebrew Cask 安装软件

brew cask install phpstorm

brew cask install visual-studio-code

brew cask install sublime-text

brew cask install sourcetree

brew cask install filezilla

brew cask install sequel-pro

brew cask install TablePlus

brew cask install dingtalk

brew cask install sogouinput

开发环境

个人喜欢 Valet

brew install php

brew install mysql@5.7

brew install nginx

brew install dnsmasq

brew install composer

brew install redis

安装 laravel

composer global require "laravel/installer"

composer global require laravel/valet #确保 ~/.composer/vendor/bin 目录位于系统的「PATH」中

如果报错执行下面的命令

export PATH="$PATH:$HOME/.composer/vendor/bin"

valet install 运行 valet install 命令来配置和安装 Valet 和 DnsMasq,并注册 Valet 后台随机启动。

iterm2 配置

brew install iterm2

检查终端默认 shell 期待 /bin/zsh

echo $SHELL

安装 oh-my-zsh

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

如果要使用什么插件,需要在 ~/.zshrc 文件中进行添加

subl ~/.zshrc

安装字体

git clone https://github.com/powerline/fonts.git --depth=1

cd fonts

./install.sh

cd ..

rm -rf fonts

在 .zshrc 修改代码

ZSH_THEME="agnoster"

隐藏前面的主机名,在 .zshrc 下面添加下面的代码

prompt_context () { }

隐藏前面的用户名在 .zshrc 下面添加下面的代码

DEFAULT_USER="username"

隐藏第一行

touch ~/.hushlogin

rm ~/.hushlogin

插件安装

zsh-autosuggestions 自动补全

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

zsh-syntax-highlighting 语法高亮

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

plugins=(zsh-autosuggestions zsh-syntax-highlighting)

source ~/.zshrc

生成密钥

ssh-keygen

cat ~/.ssh/id_rsa.pub

开发环境配置