1
5

More than 1 year has passed since last update.

M1 Mac (M1 Pro/Max)での開発環境セットアップ

Last updated at Posted at 2021-11-18

はじめに

あえてMBP"14 2021をtime machineを使わずにclean setupしたので、備忘録です.

まずはxcodeのinstall

$ xcode-select --install

App storeでxcodeもinstallし、

$ sudo xcodebuild -license

homebrewのinstall

すでにM1対応済みです.

https://brew.sh/index_ja をブラウザで開いて、install用のshell scriptを
コピペ

以下は2021/11/17時点でのinstall script

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/あなたのユーザー名/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started

homebrewを使ったinstall

$ brew install --cask visual-studio-code
$ brew install sublime-text --cask

基本folderの作成

$ cd ~
$ mkdir work
$ mkdir bin
$ mkdir .ssh
$ chmod 0700 .ssh

基本pathの設定

$ vim ~/.zprofile
~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH=$PATH:~/bin

C/C++ development

ccache

$ brew install ccache

gtestのinstall

$ brew install cmake
$ git clone https://github.com/google/googletest.git
$ cd googletest
$ mkdir build
$ cd build
$ cmake -DCMAKE_CXX_COMPILER="c++" -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++" ../
$ make
$ sudo make install

arduino

Android development

repoのinstall

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod +x ~/bin/repo

android studioのinstall

Pixel3のarm emulatorのスピードが感動するレベルでサクサク.

引っ越し系

設定系

  • .gitconfig
  • .ssh以下のファイル (sshや、github.comなどでも必要)
  • .netrc (github.comでも必要なので忘れずに)
  • .bash_profileから、.zprofileへ (環境変数などで必要なもの)

必要なアプリの引っ越し

例: Sublime Text 2 (最新のarm対応版を使う方がよいですよ. 単なる例です)

移行元で

$ cd /Applications
$ tar zcvf subl.tgz "Sublime Text 2"
$ cd ~
$ cd "Library/Application Support"
$ tar zcvf subl-conf.tgz "Sublime Text 2"

移行先で逆(tar zxvf等展開)をする

$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /Users/xxxx/bin

Machine learning

Tensor flow for Macのinstall

$ wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh
$ chmod +x ./Miniforge3-MacOSX-arm64.sh
$ sh ./Miniforge3-MacOSX-arm64.sh
$ source ~/miniforge3/bin/activate
$ conda install -c apple tensorflow-deps
$ python -m pip install tensorflow-macos
$ python -m pip install tensorflow-metal

optional: Windows app環境構築

1
5
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
1
5