ブログ - findutils
macOSはBSDベースなのでLinuxとはコマンドオプションなどがちょいちょい違います.
今回はfindコマンドのLinuxとの互換性のために,GNU findをインストール.
まずはリポジトリを確認.
インストールの実行とコマンドの確認.
/usr/local/opt/findutils/libexec/gnubinにパスを通してもいいけれど,/usr/local/bin/にシンボリックリンクが設定されているのがわかりましたので,今回はパスは通しません.
gfindだと覚えにくい?ので,findコマンドをaliasで置き換える..bash_profileに設定を投入して反映させ,試してみます.
実体のgfindコマンドがエラーになったのでalias成功.
今回はfindコマンドのLinuxとの互換性のために,GNU findをインストール.
まずはリポジトリを確認.
$ brew info findutils🆑
==> findutils: stable 4.9.0 (bottled)
Collection of GNU find, xargs, and locate
https://www.gnu.org/software/findutils/ 🈁
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/findutils.rb
License: GPL-3.0-or-later
==> Caveats
All commands have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"
==> Analytics
install: 6,145 (30 days), 19,264 (90 days), 114,718 (365 days)
install-on-request: 6,009 (30 days), 18,762 (90 days), 110,210 (365 days)
build-error: 2 (30 days)
$
インストールの実行とコマンドの確認.
$ brew install findutils🆑
ー略ー
$ ls -la /usr/local/opt/findutils/libexec/gnubin🆑
total 0
drwxr-xr-x 6 ujpadmin admin 192 2 2 2022 .
drwxr-xr-x 6 ujpadmin admin 192 2 2 2022 ..
lrwxr-xr-x 1 ujpadmin admin 15 2 2 2022 find -> ../../bin/gfind
lrwxr-xr-x 1 ujpadmin admin 17 2 2 2022 locate -> ../../bin/glocate
lrwxr-xr-x 1 ujpadmin admin 19 2 2 2022 updatedb -> ../../bin/gupdatedb
lrwxr-xr-x 1 ujpadmin admin 16 2 2 2022 xargs -> ../../bin/gxargs
$ which gfind🆑
/usr/local/bin/gfind
$
gfindだと覚えにくい?ので,findコマンドをaliasで置き換える..bash_profileに設定を投入して反映させ,試してみます.
$ echo alias find=gfind >> ~/.bash_profile🆑
$ tail -n 1 ~/.bash_profile
alias find=gfind
$ source ~/.bash_profile🆑
$ find -i🆑
gfind: unknown predicate `-i'
$