Setting Develop Environment for Mac with Homebrew
Written by SGLee, VCANUS
Basic Tools
XCode
install XCode
install Xcode on App Store The below is not needed if command line tools are already installed.
install XCode Command Line Tools
$ xcode-select --install
Homebrew
install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
add path to .zshrc
# for arm chip
export HOMEBREW_HOME="/opt/homebrew"
# for intel chip
#export HOMEBREW_HOME="/usr/local"
export PATH="$HOMEBREW_HOME/bin:$PATH"
export PATH="$HOMEBREW_HOME/sbin:$PATH"
update homebrew
$brew update
Rosetta 2
sudo softwareupdate --install-rosetta
Java
AdoptOpenJdk: Deprecated
Install Temurin (https://adoptium.net/installation/)
brew install --cask
# to install different versions
brew tap homebrew/cask-versions
brew install --cask temurin8
brew install --cask temurin11
brew install --cask temurin17
jenv (java version switching tool)
install
brew install jenv
update .zshrc
# jenv config
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
register jdk path to jenv
jenv add /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
jenv add /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
set default java version
jenv global temurin64-17.0.9
enable jenv plugin
jenv enable-plugin export
Essential libraries
install maven, openssl, etc.
install maven
$ brew install maven
install cmake
$ brew install cmake
install openssl (참고만 하고 설치하지 말 것)
$ brew install openssl
==> intel chip
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
==> M1 chip
openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
Python
Target: Pytorch, OpenCV, Tensorflow https://developer.apple.com/metal/pytorch/ https://pytorch.org/get-started/locally/#mac-python
Conda
https://angel-breath.tistory.com/29
install miniconda (arm chip)
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh
sh Miniconda3-latest-MacOSX-arm64.sh
install miniconda (intel chip)
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
sh Miniconda3-latest-MacOSX-x86_64.sh
usage
create env
conda create -n {env-name} python={version}
remove env
conda env remove -n {env-name}
search env list
conda env list
activate/deactivate
conda activate {env-name}
conda deactivate
PyCharm에서 활용
conda env 생성
python 버전 설정으로 동일 환경 유지
conda create -n flowbroker python=3.11
PyCharm 설정
Settings > Projejct > Python Interpreter > Add Interpreter > Conda Environment > Use Existing Environment
PyCharm 프로젝트 내 라이브러리 설치
github repository
pip로 설치
pip install git+https://github.com/vcanus/vpy-util.git@develop
pip install git+https://github.com/vcanus/vpy-communication-api.git@develop
일반 라이브러리
conda install {library}
Jupyter
install Jupyter notebook
https://jupyter.org/install https://towardsdatascience.com/how-to-set-up-anaconda-and-jupyter-notebook-the-right-way-de3b7623ea4a https://bbooo.tistory.com/25
conda install -c conda-forge jupyterlab
conda install -c conda-forge nb_conda_kernels
install libraries
conda activate {conda-env}
conda install ipykernel
run Jupyter
jupyter lab # run jupyter notebook
Etc. libraries
brew install hiredis
brew install boost
brew search google
brew install googletest
brew install protobuf protobuf-c
brew install cnats
brew install protobuf protobuf-c
brew install --cask flutter
Leave a comment