BrewでインストールされたVimを見つける方法は?

BrewでインストールされたVimを見つける方法は?

Brewを使ってvimをインストールしましたが、非常に異なる場所にインストールされました。では、シェルスクリプトでそのvimを探したいと思います。良い方法はありますか?

ベストアンサー1

binhomebrewプレフィックスの下のディレクトリに新しくインストールされたvimを見つける必要があります。

echo `brew --prefix`/bin/vim

もちろん、地下室がどこに設置されているかをbrew info vim教えてくれます。私はhomebrewを使ってインストールしていないので、次の使用例を紹介します。brewvimvimwget

benlavery@Talantinc:~ $>brew info wget
wget: stable 1.16.3, HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/opt/homebrew/Cellar/wget/1.14 (8 files, 716K)
  Built from source
/opt/homebrew/Cellar/wget/1.15_1 (9 files, 908K)
  Built from source
/opt/homebrew/Cellar/wget/1.16 (9 files, 920K)
  Built from source
/opt/homebrew/Cellar/wget/1.16.1 (9 files, 940K)
  Built from source
/opt/homebrew/Cellar/wget/1.16.3 (9 files, 1.5M) *
  Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/wget.rb
==> Dependencies
Build: xz ✔
Recommended: openssl ✔
Optional: libressl ✘, pcre ✘
==> Options
--with-debug
        Build with debug support
--with-iri
        Enable iri support
--with-libressl
        Build with libressl support
--with-pcre
        Build with pcre support
--without-openssl
        Build without openssl support
--HEAD
        Install HEAD version

アスタリスク(*)で示されている最新バージョンを確認できます。

だから私のためにwgetインストールされるのは

/opt/homebrew/Cellar/wget/1.16.3/bin/wget

findこれで、以下を使用してホームブリッジシンボリックリンクの位置を検索できますwget

benlavery@Talantinc:~ $>find / -lname *Cellar/wget/1.16.3/bin/wget 
/opt/homebrew/bin/wget

私はフルパスでは*Cellar/wget/1.16.3/bin/wgetなくを使用しています。lnameHomebrewはインストールに関連するファイルをリンクするので、フルパスを使用すると../Cellar/wget/1.16.3/bin/wget

/opt/homebrew/bin/wget今これが私のスクリプトで使用する必要があることを知っています。

私が言ったように、これを使用しており、wget同じプロセスを使用して場所を調べることができますvim

おすすめ記事