【Mac】brew、node等環(huán)境搭建

一.安裝brew

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

遇到源問(wèn)題安裝不了,參考:
http://www.itdecent.cn/p/e0471aa6672d?utm_campaign=hugo
http://www.itdecent.cn/p/ed35ce1981e8

安裝過(guò)程記錄:

lsan@lichaodeMacBook-Pro-2021 ~ % ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"       
Warning: Ruby版本Homebrew安裝腳本已被廢棄,新版腳本使用Bash重寫。
請(qǐng)使用以下命令:
  /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"

==> Checking for `sudo` access (which may request your password).
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> 安裝提示
中文安裝教程(建議收藏):https://brew.idayer.com/
如果你想換源,可以使用鏡像助手:https://brew.idayer.com/guide/change-source/

安裝遇到問(wèn)題,可以通過(guò)討論群尋求幫助。
也歡迎加群討論,掃碼關(guān)注公眾號(hào)(湖中劍),回復(fù)'brew'加入討論群。

█████████████████████████████████████
█████████████████████████████████████
████ ▄▄▄▄▄ █?█ █▄?▄ ▄ ▄▄██ ▄▄▄▄▄ ████
████ █   █ █???█ ?█????▄?█ █   █ ████
████ █▄▄▄█ █? █??█▄? █?▄ █ █▄▄▄█ ████
████▄▄▄▄▄▄▄█▄? ?▄█▄? █▄? █▄▄▄▄▄▄▄████
████     ?▄▄▄▄?▄?▄▄█??█ █ ? ?▄█▄?████
████ ?█▄??▄  █▄█?█ ▄██ █ ? ▄▄██?█████
████ █   █▄ ▄ ▄█▄ ?  ██ ? ???▄ █?████
████ ██▄██▄? █  ▄█? ▄▄?? ? █▄█▄?█████
████ ▄ ?▄▄▄?█▄ ▄?     ? ?█? ?? █?████
████ █ ???▄█▄█▄█?█?▄ █??▄▄█▄▄▄▄?█████
████▄██▄▄█▄█???█▄█▄ ?▄?█ ▄▄▄ ?   ████
████ ▄▄▄▄▄ █▄?  ▄█▄  ▄?  █▄█  ▄?█████
████ █   █ █ ?▄▄ ?▄ ?███ ▄▄▄▄ ▄? ████
████ █▄▄▄█ █ ▄▄? ██▄?▄?▄ ?▄   ▄ █████
████▄▄▄▄▄▄▄█▄▄█▄▄████▄█████▄▄█▄██████
█████████████████████████████████████
█████████████████████████████████████


請(qǐng)按回車鍵(RETURN)繼續(xù)安裝,按其他任意按鍵取消安裝
==> /usr/bin/sudo /usr/sbin/chown -R lsan:admin /opt/homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 7531, done.
remote: Counting objects: 100% (7531/7531), done.
remote: Compressing objects: 100% (1581/1581), done.
remote: Total 7531 (delta 5798), reused 7531 (delta 5798)
Receiving objects: 100% (7531/7531), 1.61 MiB | 2.21 MiB/s, done.
Resolving deltas: 100% (5798/5798), completed with 737 local objects.
From https://mirrors.ustc.edu.cn/brew
 * [new tag]             1.1.0.1                           -> 1.1.0.1
 * [new tag]             1.1.2.1                           -> 1.1.2.1
 * [new tag]             1.2.7                             -> 1.2.7
 * [new tag]             1.2.8                             -> 1.2.8
 * [new tag]             backup/activesupport-23-38-09     -> backup/activesupport-23-38-09
 * [new tag]             backup/brew-cask-style-14-54-55   -> backup/brew-cask-style-14-54-55
 * [new tag]             backup/create-cache-00-29-47      -> backup/create-cache-00-29-47
 * [new tag]             backup/days-03-02-52              -> backup/days-03-02-52
 * [new tag]             backup/days-03-02-59              -> backup/days-03-02-59
 * [new tag]             backup/days-19-30-23              -> backup/days-19-30-23
 * [new tag]             backup/gpg-verification-01-53-16  -> backup/gpg-verification-01-53-16
 * [new tag]             backup/remove-popen-read-19-56-50 -> backup/remove-popen-read-19-56-50
 * [new tag]             backup/remove-popen-read-20-00-21 -> backup/remove-popen-read-20-00-21
HEAD is now at fa4f239cd Merge pull request #12496 from dduugg/yard-tag-cleanup
==> Tapping homebrew/core
remote: Enumerating objects: 32, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 1101592 (delta 18), reused 0 (delta 0)
Receiving objects: 100% (1101592/1101592), 452.62 MiB | 2.07 MiB/s, done.
Resolving deltas: 100% (765843/765843), done.
From https://mirrors.ustc.edu.cn/homebrew-core
 * [new branch]      master     -> origin/master
HEAD is now at 392884bcaa0 fortio: update 1.19.0 bottle.
HOMEBREW_BREW_GIT_REMOTE set: using https://mirrors.ustc.edu.cn/brew.git for Homebrew/brew Git remote.
HOMEBREW_CORE_GIT_REMOTE set: using https://mirrors.ustc.edu.cn/homebrew-core.git for Homebrew/core Git remote.
Warning: ?。。。。。。。。。?! 重要  ?。。。。。。。。。。。。。?!
Warning: 看到此提示,一定要執(zhí)行 Next steps 中的 環(huán)境變量設(shè)置!??!
Warning: /opt/homebrew/bin is not in your PATH.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
Warning: ?。。。。。。。。。。?重要  ?。。。。。。。。。。。。。?!
切記執(zhí)行環(huán)境變量設(shè)置!,如已執(zhí)行過(guò)請(qǐng)忽略。
- 執(zhí)行下面命令將 Homebrew 到 PATH 中:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/lsan/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
  如有疑問(wèn),可以訪問(wèn) https://brew.idayer.com/guide/m1/
- ?? 恭喜,安裝成功!運(yùn)行 `brew help` 開(kāi)始體驗(yàn)吧
- 更多文檔: 
    https://docs.brew.sh
    https://brew.idayer.com
lsan@lichaodeMacBook-Pro-2021 ~ % echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/lsan/.zprofile
lsan@lichaodeMacBook-Pro-2021 ~ % eval "$(/opt/homebrew/bin/brew shellenv)"
lsan@lichaodeMacBook-Pro-2021 ~ % 

二.安裝node、npm

brew install node

四.安裝jdk

1.到官網(wǎng)下載jdk8
https://www.oracle.com/java/technologies/downloads/#java8

2.安裝后,查看jdk路徑/usr/libexec/java_home -V
3.配置環(huán)境變量

vim .bash_profile

在最后一行添加

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home

wq保存后即可


vim ~/.bash_profile

在最后一行添加

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export CLASS_PATH=$JAVA_HOME/lib
source ~/.bash_profile

五.安裝mvn

1.到官網(wǎng)下載bin包
http://maven.apache.org/download.cgi

2.解壓到自己想放的本地路徑,這里使用/usr/local/
3.配置環(huán)境變量

vi ~/.bash_profile

添加:

export MAVEN_HOME=/usr/local/apache-maven-3.8.4
export PATH=$PATH:$MAVEN_HOME/bin

wq保存后,使其生效

source ~/.bash_profile
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容