Open4

Mac環境構築

@tyamahori@tyamahori
$ softwareupdate --install-rosetta --agree-to-license
$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ arch -arm64e /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ cd
vim .zshrc

メモ
~/.zshrc

typeset -U path PATH
path=(
        /opt/homebrew/bin(N-/)
        /usr/local/bin(N-/)
        $path
)

if (( $+commands[sw_vers] )) && (( $+commands[arch] )); then
        [[ -x /usr/local/bin/brew ]] && alias brew="arch -arch x86_64 /usr/local/bin/brew"
        alias x64='exec arch -x86_64 /bin/zsh'
        alias a64='exec arch -arm64e /bin/zsh'
        switch-arch() {
                if  [[ "$(uname -m)" == arm64 ]]; then
                        arch=x86_64
                elif [[ "$(uname -m)" == x86_64 ]]; then
                        arch=arm64e
                fi
                exec arch -arch $arch /bin/zsh
        }
fi

setopt magic_equal_subst

参考
https://zenn.dev/ress/articles/069baf1c305523dfca3d

zshrc更新

$ source ~/.zshrc

Brewfile作る

$ cd
$ touch Brewfile
$ vim Brewfile

Brewfile

tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/core"

brew "asdf"
brew "tree"
brew "git"
brew "mas"
brew "autoconf"
brew "automake"
brew "bison"
brew "freetype"
brew "gettext"
brew "icu4c"
brew "krb5"
brew "libedit"
brew "libiconv"
brew "libjpeg"
brew "libpng"
brew "libxml2"
brew "libzip"
brew "pkg-config"
brew "re2c"
brew "zlib"
brew "gd"
brew "libsodium"
brew "oniguruma"
brew "pict"

cask "rancher" 
cask "astah-professional"
cask "fig"
cask "gather"
cask "google-chrome"
cask "google-drive"
cask "google-japanese-ime"
cask "hyper"
cask "microsoft-excel"
cask "microsoft-word"
cask "microsoft-powerpoint"
cask "phpstorm"
cask "visual-studio-code"
cask "zoom"
cask "slack"
cask "alt-tab"

= をつける

$ =brew upgrade
$ =brew upgrade --cask --greedy
$ =brew bundle

これで登録しておく

$ =brew upgrade && =brew upgrade --cask --greedy && =brew bundle
@tyamahori@tyamahori

=brewとする

asdf でエラーになるためバージョンを変更する

$ =brew unlink openssl@3 && =brew link openssl@1.1
$ cd
$ echo -e "\n. $(=brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zprofile

これになるはず

. /opt/homebrew/opt/asdf/libexec/asdf.sh
$ source .zprofile
$ asdf plugin-add php https://github.com/asdf-community/asdf-php.git
$ asdf install php 8.2.12

エラーが出たらひたすら =brew install hogehoge とやる。

オプションコマンド

$ =brew install autoconf automake bison freetype gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip pkg-config re2c zlib;

そのフォルダ以下だけで使う場合

$ asdf local php 8.2.12 

マシン全体で使う場合

$ asdf global php 8.2.12 
$ pecl install xdebug
[opcache]
zend_extension = opcache.so
opcache.enable = 1

[xdebug]
zend_extension="xdebug.so"
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003

[memory]
memory_limit=-1
@tyamahori@tyamahori
$ asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
$ asdf install golang latest
$ asdf global golang latest
$  which go && go version

.zshrcに追加する

export GOPATH=$(go env GOPATH)
export PATH=$PATH:$GOPATH/bin
$ source .zshrc
$ echo $GOPATH
$ echo $PATH