天天看点

mac book 搭建开发环境

mac book 搭建开发环境

(1)安装jdk

注意:要下载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"

path=".:$path:$java_home/bin"

参考:http://www.cnblogs.com/symen/p/4974408.html

(3)安装foxmail

下载地址:http://www.foxmail.com/mac/en/

mac book 搭建开发环境

 (3)安装airmail2

airmail2 是一个邮件客户端

mac book 搭建开发环境

(4)配置hosts

参考:http://laod.cn/hosts/2015-google-hosts.html

需要把git的私钥拷贝到 /users/whuanghkl/.ssh 下

mac book 搭建开发环境
mac book 搭建开发环境

(6)运行idea 报错:

error:java: javactask: source release 1.7 requires target release 1.7

mac book 搭建开发环境

 解决方法:

进入settings

mac 中使用快捷键 command+逗号

mac book 搭建开发环境

 把1.5改为1.7就好了

 (7)安装hosts切换工具

mac下 hosts切换工具:gas mask

下载地址:http://www.macupdate.com/app/mac/29949/gas-mask/download

mac book 搭建开发环境
mac book 搭建开发环境

 附件也可以下载

(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:

==> the following directories will have their group set to admin:

press return to continue or any other key to abort

mac book 搭建开发环境

更新brew

brew update

安装mounty

brew install caskroom/cask/mounty

 (9)设置安全级别,方便安装app

有时候安装mac 软件时,提示无法安装或无法打开:

mac book 搭建开发环境

 解决方法:设置为anywhere

mac book 搭建开发环境

 设置之前,先需要点击

mac book 搭建开发环境

 解锁

见附件

(10)安装alfred

参考:http://www.jianshu.com/p/957a45a8b8f2

需要设置alfred两个地方:

(a)设置开机自启动

mac book 搭建开发环境

 (b)启动剪切板功能

mac book 搭建开发环境

(11)设置mac 中path环境变量

mac中的命令都会去path中找

注意是大写的path,而不是path,与linux不同.

配置maven的时候就被坑了.

下面是我mac中/etc/profile的配置:

mac book 搭建开发环境

# 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  

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