Open7
Mac環境構築

sudo rm -rf /Applications/Google\ Chrome.app
$ 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
参考
zshrc更新
$ source ~/.zshrc
Brewfile作る
$ cd
$ touch Brewfile
$ vim Brewfile
tapはなくても良さそう?
Brewfile
brew "tree"
brew "git"
brew "mas"
cask "rancher"
cast "amazon-q"
cask "astah-professional"
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"
cask "firefox"
=
をつける
$ =brew bundle
$ =brew upgrade --cask --greedy
これで登録しておく
$ =brew upgrade && =brew upgrade --cask --greedy && =brew cleanup

=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

$ 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

.shh/config
Host github.com
IdentityFile ~/.ssh/id_ed25519
User git

devbox
sh <(curl -L https://nixos.org/nix/install)
curl -fsSL https://get.jetify.com/devbox | bash
devbox global add php go direnv git bun git curl

devbox.jsonのpackageの記述は以下にすると良さそう
"packages": [
"autoconf",
"bison",
"re2c",
"pkg-config",
"libxml2",
"sqlite",
"libiconv",
"openssl",
"libpng",
"libjpeg",
"xorg.libXpm"
],
@latest とかはいらない。
また、direnvを使う前提なので、 direnv allow
を都度やる

direnv のパスの場合、そのプロジェクトで設定したいパスを最初に来るようにする