Skip to content

macOS

M4 / macOS Sequioa 15.4.1 へ sshpass をインストールする

以前に以下のメモを書きました。

現在は Homebrew Formulae で sshpass が公開されている ようです。 簡単ですが、インストール手順をメモしておきます。

macOS に PowerShell をインストールする

PowerShell から Entra ID (旧 Azure Active Directory) を操作するには AzureAD PowerShell モジュールを利用していました。 ですが、2024 年 4 月ごろに 重要なお知らせ: Azure AD PowerShell および MSOnline PowerShell モジュールの廃止 で以下のようにアナウンスされている通り、このモジュールは非推奨になっています。

2021 年に、Microsoft Entra の PowerShell 提供元として、今後は Microsoft Graph PowerShell SDK に投資すること、また Azure AD および MSOnline PowerShell モジュールからの 移行計画について発表 いたしました。2023 年には、Azure AD と MSOnline PowerShell モジュールの非推奨化を 2024 年 3 月 30 日に行うと 発表 しました。その後、Microsoft Graph PowerShell SDK に不足していた機能の解消が大幅に進み、2024 年 3 月 30 日をもって、これらの PowerShell モジュールは非推奨となりました:

また、Microsoft Graph PowerShell を使用して Microsoft 365 に接続する にも以下の記載があります。

Azure Active Directory (AzureAD) PowerShell モジュールは非推奨となり、Microsoft Graph PowerShell SDK に置き換えられます。 Microsoft Graph PowerShell SDK を使用して、すべての Microsoft Graph API にアクセスできます。 詳細については、「Microsoft Graph PowerShell SDK の使用を開始する」 を参照してください。

Microsoft Graph PowerShell のインストールと Microsoft Graph PowerShell へのアップグレードの方法については、「Microsoft Graph PowerShell SDK のインストール」と「 Azure AD PowerShell から Microsoft Graph PowerShell へのアップグレード」も参照してください。

このように、今後は Microsoft Graph PowerShell の利用が推奨されているようです。 今回は macOS 上に PowerShell をインストールし、Graph を利用出来るようにする手順をメモしておきます。

ripgrep-all を使って CLI で PDF を検索する

以前に Ubuntu に ripgrep をインストールする というメモを書きました。 ripgrep (rg) は [Rust] 製のツールで grep と同じように検索が行えます。 ripgrep がインストールされている前提ですが、rga を使うとテキストファイルだけで無く、様々なファイルを検索出来るようになります。 ripgrep-all の GitHub ページには以下の説明がされています。

rga is a line-oriented search tool that allows you to look for a regex in a multitude of file types. rga wraps the awesome ripgrep and enables it to search in pdf, docx, sqlite, jpg, movie subtitles (mkv, mp4), etc.

ripgrep も ripgrep-all も macOS であれば Homebrew から、Ubuntu であれば Rust Tools apt repo から、いずれにしても簡単にインストールすることが出来ます。 Rust Tools apt repo のインストール方法は Ubuntu に「Rust Tools apt repo」をインストールする にメモしました。 今回は ripgrep-all を使って PDF ファイルを検索する方法をメモしておきます。

CLI の HTTP クライアントである xh の基本的な使い方

以前に HTTPie のインストールと基本的な使い方 というメモを書きました。 HTTPie は CLI の HTTP / HTTPS クライアントです。 これを Rust で書き直したものが xh です。 xh は HTTPie とオプションがほぼ互換である為、HTTPie の利用経験があれば xh も利用出来るはずです。 HTTPie と xh の比較については How xh compares to HTTPie に以下の記載があります。

Advantages
  • Improved startup speed.
  • Available as a single statically linked binary that's easy to install and carry around.
  • HTTP/2 support.
  • Builtin translation to curl commands with the --curl flag.
  • Short, cheatsheet-style output from --help. (For longer output, pass help.)
Disadvantages
  • Not all of HTTPie's features are implemented. (#4)
  • No plugin system.
  • General immaturity. HTTPie is old and well-tested.
  • Worse documentation.

今回は xh の基本的な使い方をメモしておきます。

asdf は 0.16 からディレクトリ構造が大幅に変化している

asdf は様々なランタイムを管理出来るバージョンマネージャです。 Golang で実装されています。 ただ、後発の Rust で実装された mise (旧名は rtx) は「asdf 用のプラグインは全て使えるが、asdf より速い」とうたっています。 これを受けてなのか、asdf は バージョン 0.16.0 の Changelog に下記の記載があります。 記載内容によると「バージョン 0.16.0 からより速く、シンプルで、メンテナンスし易いように書き直した」ようです。

Rewrite asdf in Golang The rewrite in Go was spread across 88 pull requests that are all included in this release. The primary goal of the rewrite was to create a codebase that was faster, simpler and easier to maintain. The rewrite tries to maintain feature parity with the previous version. However, a number of breaking changes were introduced. Some of these were due to the change of language, a few out of a desire to simplify the code, and some to improve the user experience. For the full list of breaking changes and the upgrade guide visit the Upgrading to 0.16.0 page on the asdf website. It is highly recommended that you read this guide before upgrading.

ですが、私の macOS 環境では 0.15 系から 0.16.1 へバージョンアップしたところ、下記のエラーが出るようになってしまいました。

/Users/USERNAME/.zshrc:.:10: no such file or directory: /opt/homebrew/opt/asdf/libexec/asdf.sh

.zshrc では バージョン 0.15 までのガイド に従って以下のように設定してありましたが、これがエラーになっているようです。

.zshrc
# asdf
. /opt/homebrew/opt/asdf/libexec/asdf.sh