Mac下JDK、Maven、Tomcat、Git開發安裝及環境變量配置


本文主要內容: 
- 1.Mac OS 10.11.6 [OS X EL Captain] 
- 2.Mac OS 安裝Java 設置環境變量 
- 3.Mac OS 安裝Maven設置環境變量 
- 4.Mac OS 安裝Tomcat設置環境變量 
- 5.Mac OS 安裝HomeBrew服務器 
- 6.Mac OS 安裝Git 服務器

1.Mac OS 10.11.6 [OS X EL Captain]

Mac OS是一套運行於蘋果Macintosh系列電腦上的操作系統。Mac OS是首個在商用領域成功的圖形用戶界面操作系統。Mac系統是基於Unix內核的圖形化操作系統;一般情況下在普通PC上無法安裝的操作系統。由蘋果公司自行開發。新系統非常可靠;它的許多特點和服務都體現了蘋果公司的理念。現行的最新的系統版本是macOS Sierra 10.12,且網上也有在PC上運行的Mac系統,簡稱 Mac PC。—— [ 百度百科 ]

  2011年7月20日Mac OS X已經正式被蘋果改名為OS X。最新版本為10.10,2014年10月21日凌晨1點發布。

  2016年6月13日,在蘋果開發者大會WWDC發布了產品Mac OS的新功能。

  由於我的電腦上預裝的OS X El Capitan 10.11.6,OS X El Capitan系統是蘋果2015年9月29日宣布的作為免費更新面向Mac用戶提供的操作系統。

  因此,我的實踐均和OS X El Capitan 10.11.6 版本有關,其他版本出現問題或安裝失敗,請自行參照其他博主的教程。

2.Mac OS 安裝Java 設置環境變量

  1.獲取Java 安裝包: [ Java 安裝包獲取地址]。

  在下載Java 安裝包的時候一定要下載 Java JDK ,別下載 Java JRE,因為Java JDK 里面包含有Java JRE ,而Java JRE 並不不包含 Java JDK 。 我下載的是 Java JDK 1.8,Mac OS 版本 。

  2.安裝Java JDK 

  一直默認安裝就好,直到完成。

  3.接下來是本教程的核心內容,就是設置環境變量 

  3.1 打開終端,輸入echo Shell使shellbashBourneshellUnixShellechoShell,查看系統使用shell腳本類型,如果輸出的是bash,說明是Bourneshell,是默認的UnixShell命令。注意,echoShell 的S一定是大寫,否則會報錯。 
  3.2 輸入java-version查看java 版本信息,如果安裝成功就會輸出如下信息:

192:~ houjing$ java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

  如果不是的話,說明沒有安裝成功,需要檢查原因,重新安裝后再執行此操作。

  3.3 使用工具命令“/usr/libexec/java_home”來定位JAVA_HOME: 

192:~ houjing$ /usr/libexec/java_home -V 
Matching Java Virtual Machines (1):
    10.0.1, x86_64:    "Java SE 10.0.1"    
/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home

  如果出現 /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home,這就是Java 的安裝路徑,就是Windows 系統所說的Path。

  3.4 配置JAVA_HOME:輸入vim .bash_profile ,進入vim編輯器view視圖

  3.5 鍵盤輸入i,進入插入模式,在文件尾部添加java安裝路徑:

JAVA_HOME=/Library/java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export JAVA_HOME
export PATH
export CLASSPATH

  3.6 添加完畢之后,按esc退出插入模式,並鍵入wq!保存退出文件

  3.7 如果保存時出現:vi E212:Can’t open file for writing 說明你沒有修改權限,如果沒有說明已經構建成功,不用執行8-10操作

  3.8 退出vim編輯器,在終端輸入 sudo su命令,輸入開機密碼

  3.9 輸入vim .bash_profile 命令,進入vim編輯器view視圖

  3.10 鍵盤輸入i,進入插入模式,在文件尾部添加java安裝路徑:

JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home"
CLASS_PATH="$JAVA_HOME/lib"
PATH=".;$PATH:$JAVA_HOME/bin"
export JAVA_HOME

  3.11 輸入echo $JAVA_HOME查看路徑是否正確,如果正確則繼續下面的操作,如果不正確則需要修改。

  3.12 輸入source .bash_profile 使得修改的文件生效。

  3.13 輸入java 命令,到此設置完畢。

192:~ houjing$ java
用法: java [options] <主類> [args...]
           (執行類)
   或  java [options] -jar <jar 文件> [args...]
           (執行 jar 文件)
   或  java [options] -m <模塊>[/<主類>] [args...]
       java [options] --module <模塊>[/<主類>] [args...]
           (執行模塊中的主類)

 將主類, -jar <jar 文件>, -m 或 --module
 <模塊>/<主類> 后的參數作為參數傳遞到主類。

 其中, 選項包括:

    -cp <目錄和 zip/jar 文件的類搜索路徑>
    -classpath <目錄和 zip/jar 文件的類搜索路徑>
    --class-path <目錄和 zip/jar 文件的類搜索路徑>
                  使用 : 分隔的, 用於搜索類文件的目錄, JAR 檔案
                  和 ZIP 檔案列表。
    -p <模塊路徑>
    --module-path <模塊路徑>...
                  用 : 分隔的目錄列表, 每個目錄
                  都是一個包含模塊的目錄。
    --upgrade-module-path <模塊路徑>...
                  用 : 分隔的目錄列表, 每個目錄
                  都是一個包含模塊的目錄, 這些模塊
                  用於替換運行時映像中的可升級模塊
    --add-modules <模塊名稱>[,<模塊名稱>...]
                  除了初始模塊之外要解析的根模塊。
                  <模塊名稱> 還可以為 ALL-DEFAULT, ALL-SYSTEM,
                  ALL-MODULE-PATH.
    --list-modules
                  列出可觀察模塊並退出
    -d <module name>
    --describe-module <模塊名稱>
                  描述模塊並退出
    --dry-run     創建 VM 並加載主類, 但不執行 main 方法。
                  此 --dry-run 選項對於驗證諸如
                  模塊系統配置這樣的命令行選項可能非常有用。
    --validate-modules
                  驗證所有模塊並退出
                  --validate-modules 選項對於查找
                  模塊路徑中模塊的沖突及其他錯誤可能非常有用。
    -D<名稱>=<值>
                  設置系統屬性
    -verbose:[class|module|gc|jni]
                  啟用詳細輸出
    -version      將產品版本輸出到錯誤流並退出
    --version     將產品版本輸出到輸出流並退出
    -showversion  將產品版本輸出到錯誤流並繼續
    --show-version
                  將產品版本輸出到輸出流並繼續
    --show-module-resolution
                  在啟動過程中顯示模塊解析輸出
    -? -h -help
                  將此幫助消息輸出到錯誤流
    --help        將此幫助消息輸出到輸出流
    -X            將額外選項的幫助輸出到錯誤流
    --help-extra  將額外選項的幫助輸出到輸出流
    -ea[:<程序包名稱>...|:<類名>]
    -enableassertions[:<程序包名稱>...|:<類名>]
                  按指定的粒度啟用斷言
    -da[:<程序包名稱>...|:<類名>]
    -disableassertions[:<程序包名稱>...|:<類名>]
                  按指定的粒度禁用斷言
    -esa | -enablesystemassertions
                  啟用系統斷言
    -dsa | -disablesystemassertions
                  禁用系統斷言
    -agentlib:<庫名>[=<選項>]
                  加載本機代理庫 <庫名>, 例如 -agentlib:jdwp
                  另請參閱 -agentlib:jdwp=help
    -agentpath:<路徑名>[=<選項>]
                  按完整路徑名加載本機代理庫
    -javaagent:<jar 路徑>[=<選項>]
                  加載 Java 編程語言代理, 請參閱 java.lang.instrument
    -splash:<圖像路徑>
                  使用指定的圖像顯示啟動屏幕
                  自動支持和使用 HiDPI 縮放圖像
                  (如果可用)。應始終將未縮放的圖像文件名 (例如, image.ext)
                  作為參數傳遞給 -splash 選項。
                  將自動選取提供的最合適的縮放
                  圖像。
                  有關詳細信息, 請參閱 SplashScreen API 文檔
    @argument 文件
                  一個或多個包含選項的參數文件
    -disable-@files
                  阻止進一步擴展參數文件
要為長選項指定參數, 可以使用 --<名稱>=<值>--<名稱> <值>。

  有關詳細信息, 請參閱 http://www.oracle.com/technetwork/java/javase/documentation/index.html

  還可以:打開終端,輸入touch .bash_profile,輸入open .bash_profile打開記事本進行編輯。

  更新配置的環境變量source .bash_profile,使得環境變量生效,可以輸入 Java 進行驗證。

3.Mac OS 安裝Maven設置環境變量

  1.獲取Maven 安裝包: [ Maven 安裝包獲取地址]。

  注意,下載Maven 的時候一定是下載:apache-maven-3.3.9-src.tar.gz,復制到你需要放置的位置,解壓(可以用tar命令或者就在)。我的文件名:

  2.打開終端,輸入touch .bash_profile,再次輸入open .bash_profile打開記事本:

export MAVEN_HOME=/Volumes/work/apache-maven-3.5.3
export PATH=$MAVEN_HOME/bin:$PATH

  3.在終端輸入source ~/.bash_profile,再輸入:mvn -v。

192:~ houjing$ mvn -v
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-25T03:49:05+08:00)
Maven home: /Volumes/work/apache-maven-3.5.3
Java version: 10.0.1, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
Default locale: zh_CN_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"

4.Mac OS 安裝Tomcat設置環境變量

  1.獲取Tomcat安裝包: [Tomcat安裝包獲取地址]。

  注意,下載Maven 的時候一定是下載:Tomcat.tar.gz,然后在桌面新建一個文件夾,名稱自定義,但是一定要為英文,不可為中文。我的文件名:ApplicationsTools,就是之前放Maven的文件夾,放在一起方便查找和管理。

  2.配置環境變量

  打開終端,輸入touch .bash_profile,再次輸入open .bash_profile打開記事本:

export CATALINA_HOME=/Volumes/work/apache-tomcat-9.0.8
export PATH=$CATALINA_HOME/bin:$PATH

  3.新環境變量

  環sourc.bash_profile入$CATALINA_HOME:

192:~ houjing$ $CATALINA_HOME
-bash: /Volumes/work/apache-tomcat-9.0.8: is a directory

  終端中輸入$PATH顯示如下:

192:~ houjing$ $PATH
-bash: /Volumes/work/apache-tomcat-9.0.8/bin:/Volumes/work/apache-maven-3.5.3/bin:/Library/java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin:
/Volumes/work/apache-tomcat-9.0.8/bin:/Volumes/work/apache-maven-3.5.3/bin:/Library/java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

  4.啟動tomcat

  終端中輸入startup.sh,startup.sh后出現類似 “Permission denied” ,這個時候需要對目錄進行權限設置:輸入 sudo chmod 755 Library/Tomcat8/bin/*.sh 回車,設置文件的讀寫執行權限;

192:~ houjing$ cd $CATALINA_HOME/bin
192:bin houjing$ pwd
/Volumes/work/apache-tomcat-9.0.8/bin
192:bin houjing$ sh startup.sh 
Using CATALINA_BASE:   /Volumes/work/apache-tomcat-9.0.8
Using CATALINA_HOME:   /Volumes/work/apache-tomcat-9.0.8
Using CATALINA_TMPDIR: /Volumes/work/apache-tomcat-9.0.8/temp
Using JRE_HOME:        /Library/java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
Using CLASSPATH:       /Volumes/work/apache-tomcat-9.0.8/bin/bootstrap.jar:/Volumes/work/apache-tomcat-9.0.8/bin/tomcat-juli.jar
Tomcat started.

  5.關閉需要使用shutdown.sh即可。

5.Mac OS 安裝HomeBrew 管理器

  1.獲取HomeBrew安裝包: [HomeBrew 管理器官網 ]。

  macOS 不可或缺的套件管理器。

  2.安裝HomeBrew

  2.1 打開終端,輸入:ruby -e “$(curl –insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)” 后回車: 

192:~ houjing$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/sbin
/usr/local/share
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var
==> The Xcode Command Line Tools will be installed.

  2.2 繼續回車: 

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include 
/usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var Password:

  2.3 輸入開機密碼,繼續回車,你是看不見的密碼的(此處還會自動幫你下載Xcode): 

Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include 
/usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var ==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions ==> /usr/bin/sudo /usr/sbin/chown houjing /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc
/usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions
/usr/local/var ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include
/usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var ==> /usr/bin/sudo /bin/mkdir -p /Users/houjing/Library/Caches/Homebrew ==> /usr/bin/sudo /bin/chmod g+rwx /Users/houjing/Library/Caches/Homebrew ==> /usr/bin/sudo /usr/sbin/chown houjing /Users/houjing/Library/Caches/Homebrew ==> /usr/bin/sudo /bin/mkdir -p /Library/Caches/Homebrew ==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew ==> /usr/bin/sudo /usr/sbin/chown houjing /Library/Caches/Homebrew ==> Searching online for the Command Line Tools ==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> Installing Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.3 ==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ (macOS\ High\ Sierra\ version\ 10.13)\ for\ Xcode-9.3 Software Update Tool Downloading Command Line Tools (macOS High Sierra version 10.13) for Xcode Downloaded Command Line Tools (macOS High Sierra version 10.13) for Xcode Installing Command Line Tools (macOS High Sierra version 10.13) for Xcode Done with Command Line Tools (macOS High Sierra version 10.13) for Xcode Done. ==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools ==> Downloading and installing Homebrew... remote: Counting objects: 101182, done. remote: Compressing objects: 100% (34/34), done. remote: Total 101182 (delta 23), reused 27 (delta 13), pack-reused 101135 Receiving objects: 100% (101182/101182), 23.11 MiB | 46.00 KiB/s, done. Resolving deltas: 100% (73636/73636), done. From https://github.com/Homebrew/brew * [new branch] master -> origin/master * [new tag] 0.1 -> 0.1 * [new tag] 0.2 -> 0.2 * [new tag] 0.3 -> 0.3 * [new tag] 0.4 -> 0.4 * [new tag] 0.5 -> 0.5 * [new tag] 0.6 -> 0.6 * [new tag] 0.7 -> 0.7 * [new tag] 0.7.1 -> 0.7.1 * [new tag] 0.8 -> 0.8 * [new tag] 0.8.1 -> 0.8.1 * [new tag] 0.9 -> 0.9 * [new tag] 0.9.1 -> 0.9.1 * [new tag] 0.9.2 -> 0.9.2 * [new tag] 0.9.3 -> 0.9.3 * [new tag] 0.9.4 -> 0.9.4 * [new tag] 0.9.5 -> 0.9.5 * [new tag] 0.9.8 -> 0.9.8 * [new tag] 0.9.9 -> 0.9.9 * [new tag] 1.0.0 -> 1.0.0 * [new tag] 1.0.1 -> 1.0.1 * [new tag] 1.0.2 -> 1.0.2 * [new tag] 1.0.3 -> 1.0.3 * [new tag] 1.0.4 -> 1.0.4 * [new tag] 1.0.5 -> 1.0.5 * [new tag] 1.0.6 -> 1.0.6 * [new tag] 1.0.7 -> 1.0.7 * [new tag] 1.0.8 -> 1.0.8 * [new tag] 1.0.9 -> 1.0.9 * [new tag] 1.1.0 -> 1.1.0 * [new tag] 1.1.1 -> 1.1.1 * [new tag] 1.1.10 -> 1.1.10 * [new tag] 1.1.11 -> 1.1.11 * [new tag] 1.1.12 -> 1.1.12 * [new tag] 1.1.13 -> 1.1.13 * [new tag] 1.1.2 -> 1.1.2 * [new tag] 1.1.3 -> 1.1.3 * [new tag] 1.1.4 -> 1.1.4 * [new tag] 1.1.5 -> 1.1.5 * [new tag] 1.1.6 -> 1.1.6 * [new tag] 1.1.7 -> 1.1.7 * [new tag] 1.1.8 -> 1.1.8 * [new tag] 1.1.9 -> 1.1.9 * [new tag] 1.2.0 -> 1.2.0 * [new tag] 1.2.1 -> 1.2.1 * [new tag] 1.2.2 -> 1.2.2 * [new tag] 1.2.3 -> 1.2.3 * [new tag] 1.2.4 -> 1.2.4 * [new tag] 1.2.5 -> 1.2.5 * [new tag] 1.2.6 -> 1.2.6 * [new tag] 1.3.0 -> 1.3.0 * [new tag] 1.3.1 -> 1.3.1 * [new tag] 1.3.2 -> 1.3.2 * [new tag] 1.3.3 -> 1.3.3 * [new tag] 1.3.4 -> 1.3.4 * [new tag] 1.3.5 -> 1.3.5 * [new tag] 1.3.6 -> 1.3.6 * [new tag] 1.3.7 -> 1.3.7 * [new tag] 1.3.8 -> 1.3.8 * [new tag] 1.3.9 -> 1.3.9 * [new tag] 1.4.0 -> 1.4.0 * [new tag] 1.4.1 -> 1.4.1 * [new tag] 1.4.2 -> 1.4.2 * [new tag] 1.4.3 -> 1.4.3 * [new tag] 1.5.0 -> 1.5.0 * [new tag] 1.5.1 -> 1.5.1 * [new tag] 1.5.10 -> 1.5.10 * [new tag] 1.5.11 -> 1.5.11 * [new tag] 1.5.12 -> 1.5.12 * [new tag] 1.5.13 -> 1.5.13 * [new tag] 1.5.14 -> 1.5.14 * [new tag] 1.5.2 -> 1.5.2 * [new tag] 1.5.3 -> 1.5.3 * [new tag] 1.5.4 -> 1.5.4 * [new tag] 1.5.5 -> 1.5.5 * [new tag] 1.5.6 -> 1.5.6 * [new tag] 1.5.7 -> 1.5.7 * [new tag] 1.5.8 -> 1.5.8 * [new tag] 1.5.9 -> 1.5.9 * [new tag] 1.6.0 -> 1.6.0 * [new tag] 1.6.1 -> 1.6.1 * [new tag] 1.6.2 -> 1.6.2 * [new tag] 1.6.3 -> 1.6.3 * [new tag] 1.6.4 -> 1.6.4 HEAD is now at 18d450122 Merge pull request #4200 from GauthamGoli/newformula-audit-condition-fix

  2.4 繼續回車 :

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4760, done.
remote: Compressing objects: 100% (4555/4555), done.
remote: Total 4760 (delta 54), reused 591 (delta 17), pack-reused 0
Receiving objects: 100% (4760/4760), 3.85 MiB | 363.00 KiB/s, done.
Resolving deltas: 100% (54/54), done.
Tapped 4548 formulae (4,801 files, 12MB)
==> Cleaning up /Library/Caches/Homebrew...
==> Migrating /Library/Caches/Homebrew to /Users/houjing/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics.html

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

  到這,HomeBrew 管理器就安裝完成了!

6.Mac OS 安裝Git

  打開終端,輸入 brew install git;

192:bin houjing$ brew install git
==> Downloading https://homebrew.bintray.com/bottles/git-2.17.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring git-2.17.0.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.17.0: 1,497 files, 35.6MB

  輸入brew install gcc:

192:bin houjing$ brew install gcc
==> Installing dependencies for gcc: gmp, isl, mpfr, libmpc
==> Installing gcc dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2_2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gmp-6.1.2_2.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/gmp/6.1.2_2: 18 files, 3.1MB
==> Installing gcc dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.19.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring isl-0.19.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/isl/0.19: 66 files, 3.8MB
==> Installing gcc dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-4.0.1.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mpfr-4.0.1.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/mpfr/4.0.1: 28 files, 4.6MB
==> Installing gcc dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.1.0.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.1.0.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/libmpc/1.1.0: 12 files, 353.8KB
==> Installing gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-8.1.0.high_sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring gcc-8.1.0.high_sierra.bottle.1.tar.gz
🍺  /usr/local/Cellar/gcc/8.1.0: 1,495 files, 336.1MB

  都完成后,輸入 git -version 和 which git 驗證是否成功,失敗重新來過!

192:bin houjing$ git --version
git version 2.17.0
192:bin houjing$ which git
/usr/local/bin/git
192:bin houjing$ git --help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone      Clone a repository into a new directory
   init       Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add        Add file contents to the index
   mv         Move or rename a file, a directory, or a symlink
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect     Use binary search to find the commit that introduced a bug
   grep       Print lines matching a pattern
   log        Show commit logs
   show       Show various types of objects
   status     Show the working tree status

grow, mark and tweak your common history
   branch     List, create, or delete branches
   checkout   Switch branches or restore working tree files
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   merge      Join two or more development histories together
   rebase     Reapply commits on top of another base tip
   tag        Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
   fetch      Download objects and refs from another repository
   pull       Fetch from and integrate with another repository or a local branch
   push       Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM