由於 Mac 是 unix 系統,所以操作指令基本上跟 Linux 是一樣的。
在 Mac 上有個很好用的套件管理程式 Homebrew
Tip: need install Xcode(need 1.0.7.3 up)
指令
brew install <要安裝的套件>
brew uninstall <要解除安裝的套件>
brew list
brew search
brew update 更新 homebrew
之後用 homebrew 安裝
brew install wget
brew install git
由於較喜歡用 zsh 的 shell (預設是 bash),接下來安裝 zsh
github 上的 oh-my-zsh
https://github.com/sjl/oh-my-zsh
Auto install
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
set zsh as default shell
chsh -s /bin/zsh
change theme
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
set zsh as default shell
chsh -s /bin/zsh
change theme
設定 zsh
vim ~/.zshrc
Mac default install vimvim ~/.zshrc
由於是用 LAMP (Linux + Apache + MySQL + PHP) 架構做開發,在 Mac 上反而更方便,因為 Mac 只有 MySQL 要自己裝,Apache 和 PHP 都預載在 Mac 中了。
start Apache
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
Apache version
sudo apachectl -v
httpd -v
start PHP
sudo vim /etc/apache2/httpd.conf
#LoadModule php5_module libexec/apache2/libphp5.so
delete #
sudo apachectl restart
into the directory(Default root)
cd ~_WWW
Library/WebServer/Documents
Change default root
vim /etc/apache2/httpd.conf
DocumentRoot
if
"/Library/WebServer/Documents"
change
Install MySQL(http://dev.mysql.com/downloads/mysql/5.5.html)
mysqladmin -u root password 'setting password'
Setting PATH
in ~
sudo vim ~/.zshrc
add
#mysql
export PATH="/usr/local/mysql/bin:$PATH"
save
source ~/.zshrc
SSH