0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【WIP】brew+zsh+tmux のPATH順序がおかしかったのでなんとかする

Posted at

記事内容編集中

背景

tmux内で$PATHを確認したら /opt/homebrew/bin がやたら後ろの方にあったので気持ち悪かった。
tmux外だと先頭の方にある。

起こりうる問題

brewで上書きしたはずコマンドがtmux内ではOSX標準のものが優先されてしまう。

この記事の結論

eval $(/opt/homebrew/bin/brew shellenv -f) で無理やり対応した

調査

/etc/zprofile

zshの読み込み順など

path_helper

色々諸問題があるらしい

brew install --disable-etcdir zsh

無くなってた

unsetopt GLOBAL_RCS

なんか思った挙動にはならない。効かない?

/opt/homebrew/bin/brew shellenv

実行しても何も出力されない

すでに実行済みだと出ないのかも?

export PATH="" # 設定次第で色々エラーでる。一時的な措置。
$ /opt/homebrew/bin/brew shellenv
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export HOMEBREW_SHELLENV_PREFIX="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

出た。

forceオプションがあるのでは??

$ /opt/homebrew/bin/brew shellenv -f
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export HOMEBREW_SHELLENV_PREFIX="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

オプション何あるのかな?

$ /opt/homebrew/bin/brew shellenv ?
export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew";
export HOMEBREW_SHELLENV_PREFIX="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

なんでもよかったらしい。。


そして、結論に。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?