mac book 搭建开发环境
(1)安装jdk
mac jdk 下载地址:http://www.oracle.com/technetwork/Java/javase/downloads/jdk8-downloads-2133151.html
注意:要下载jdk,而不是jre
(2)设置java环境变量
mac booke中安装jdk ,没有让用户选择安装目录,那么jdk安装到了哪里呢?
默认安装到了:
/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk
所以设置JAVA_HOME
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
export JAVA_HOME
CLASS_PATH= " $JAVA_HOME/lib "
参考:http://www.cnblogs.com/symen/p/4974408.html
(3)安装Foxmail
下载地址:http://www.foxmail.com/mac/en/
(3)安装Airmail2
Airmail2 是一个邮件客户端
(4)配置hosts
参考:http://laod.cn/hosts/2015-google-hosts.html
(5)配置Git代码权限
需要把git的私钥拷贝到 /Users/whuanghkl/.ssh 下
(6)运行IDEA 报错:
Error:java: javacTask: source release 1.7 requires target release 1.7
解决方法:
进入settings
mac 中使用快捷键 command+逗号
把1.5改为1.7就好了
(7)安装hosts切换工具
mac下 hosts切换工具:gas mask
下载地址:http://www.macupdate.com/app/mac/29949/gas-mask/download
附件也可以下载
(8)安装brew
参考:http://brew.sh/
安装命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装过程:
localhost:Downloads whuanghkl$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
==> The following directories will have their owner set to whuanghkl:
/usr/local/.
/usr/local/bin
==> The following directories will have their group set to admin:
/usr/local/.
/usr/local/bin
Press RETURN to continue or any other key to abort
更新brew
brew update
安装mounty
brew install Caskroom/cask/mounty
(9)设置安全级别,方便安装app
有时候安装mac 软件时,提示无法安装或无法打开:
解决方法:设置为Anywhere
设置之前,先需要点击
解锁
见附件
(10)安装Alfred
参考:http://www.jianshu.com/p/957a45a8b8f2
需要设置Alfred两个地方:
(a)设置开机自启动
(b)启动剪切板功能
(11)设置mac 中path环境变量
mac中的命令都会去PATH中找
注意是大写的PATH,而不是path,与Linux不同.
配置maven的时候就被坑了.
下面是我mac中/etc/profile的配置:
- # System-wide .profile for sh(1)
- if [ -x /usr/libexec/path_helper ]; then
- eval `/usr/libexec/path_helper -s`
- fi
- if [ "${BASH-no}" != "no" ]; then
- [ -r /etc/bashrc ] && . /etc/bashrc
- fi
- JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
- export JAVA_HOME
- M2_HOME=/Users/admin/software/apache-maven-3.3.9
- export M2_HOME
- PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
- export PATH
- alias ll='ls -l'
- alias la='ls -a'
- alias pd='pwd'
- alias cdup='cd ..'
- alias cd-='cd -'
- nginx -c /usr/local/etc/nginx/nginx.conf