0
0

More than 3 years have passed since last update.

MacBook Pro ARM版のHomeBrew関連インストール

Last updated at Posted at 2020-12-28

この記事について

この記事は、主に開発を行う上で毎回調べてしまっている初回セットアップ(主にHomeBrewとか)の整理をするために作成しています。
実施端末がタイトル通りARM版となっております。その為、時が経てば手法が大きく変わる可能性があります。この記事通りに実施できない手順に関しては、その都度調べていただけると幸いです。

実施端末

uname -v # Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101

手順

1.Command line Tool for Xcode

xcode-select --install

2.Homebrew

ARM版Homebrewのインストール

 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

3.oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

4.Zsh便利機能

zsh-autosuggestions

brew install zsh-autosuggestions
echo 'source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc

zsh-completions

brew install zsh-completions

下記を.zshrcに追記

if type brew &>/dev/null; then
   FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

   autoload -Uz compinit
   compinit
fi

zsh-syntax-highlighting

brew install zsh-syntax-highlighting
echo 'source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh' >> ~/.zshrc

5.JDK(Amazon Corretto系)

この辺りでRosetta2をインストールしてとHomeBrewから案内されます。

brew tap homebrew/cask-versions
brew install corretto 
brew install corretto8 
brew install corretto11
/usr/libexec/java_home -V # JDKの確認
# Matching Java Virtual Machines (3):
#    15.0.1 (x86_64) "Amazon.com Inc." - "Amazon Corretto 15" /Library/Java/JavaVirtualMachines/amazon-corretto-15.jdk/Contents/Home
#    11.0.9 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
#    1.8.0_272 (x86_64) "Amazon" - "Amazon Corretto 8" /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home

brew install jenv
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(jenv init -)"' >> ~/.zshrc
source ~/.zshrc
jenv add `/usr/libexec/java_home -v "1.8"`
jenv add `/usr/libexec/java_home -v "11"`
jenv add `/usr/libexec/java_home -v "15"`
jenv global corretto64-11.0.9 # corretto 11を選ぶ場合
java -version
# openjdk version "11.0.9" 2020-10-20 LTS
# OpenJDK Runtime Environment Corretto-11.0.9.11.1 (build 11.0.9+11-LTS)
# OpenJDK 64-Bit Server VM Corretto-11.0.9.11.1 (build 11.0.9+11-LTS, mixed mode)
javac -version
# javac 11.0.9

6.Yarn系

brew install yarn
yarn global add @angular/cli
yarn global add serverless
yarn global add typescript

7.Python系

brew install pyenv

# Pyenv (.zshrcに記載)
# eval "$(pyenv init -)"

pyenv install -l
pyenv install x.x.x

8.NodeJS系

nodebrewを使いたかったけどarmに未対応の為、nodenvで代替

brew install nodenv
nodenv init
# (.zshrcに追記)
# eval "$(nodenv init -)"

# インストールチェック
curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-doctor | bash

# Checking for `nodenv' in PATH: /usr/local/bin/nodenv
# Checking for nodenv shims in PATH: OK
# ....

# インストール一覧
nodenv install -l

# インストール
nodenv install 15.8.0

# 確認
nodenv versions
# * system (....)
  15.8.0

# 選択
nodenv global 

----
# global選択
nodenv global 15.8.0
---
or
---
# local選択
nodenv local 15.8.0
---
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0