【macOS / Android】scrcpy on Mac can't find "… libmbedcrypto.14.dylib" · Genymobile/scrcpy

scrcpy を起動しようとしたら、

何だか厳しそうなエラーが出ました。


dyld[90421]: Library not loaded: '/usr/local/opt/mbedtls/lib/libmbedcrypto.12.dylib'
  Referenced from: '/usr/local/Cellar/librist/0.2.7_1/lib/librist.4.dylib'
  Reason: tried: '/usr/local/opt/mbedtls/lib/libmbedcrypto.12.dylib' (no such file), '/usr/local/lib/libmbedcrypto.12.dylib' (no such file), '/usr/lib/libmbedcrypto.12.dylib' (no such file)
zsh: abort      /usr/local/Cellar/scrcpy/1.24/bin/scrcpy

👉 scrcpy on Mac can't find "…libmbedcrypto.14.dylib" · Issue #4409 · Genymobile/scrcpy hatena-bookmark

みんなが成功しているコメントから以下を実行して再インストールします。


brew uninstall librist --ignore-dependencies
brew uninstall mbedtls --ignore-dependencies
brew reinstall scrcpy

👉 Not working on Mac · Issue #3505 · Genymobile/scrcpy hatena-bookmark

だが、しかし。

 

😅 ERROR: Command not found: [adb], [start-server]


scrcpy

scrcpy v2.2 <https://github.com/Genymobile/scrcpy>
exec: No such file or directory
ERROR: Command not found: [adb], [start-server]
ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
INFO: You may install 'adb' by "apt install adb"
ERROR: Could not execute "adb start-server"
ERROR: Could not start adb server
ERROR: Server connection failed

Android Studio インストール済みだったので PATH だけ通していけました!


# .zshrc

# android-tools
export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools

【macOS / Android】scrcpy on Mac can't find "… libmbedcrypto.14.dylib" · Genymobile/scrcpy

 

😅 まとめ

macOS 新規インストールしてから、スクリプトツールたちがエラーを吐きまくってるのだが。


有料 Mac アプリ Bartender で何ができるのか

有料 Mac アプリ Bartender で何ができるのか

👉 Bartender 5 - Take control of your Menu bar hatena-bookmark

現在、2728円の有料アプリです。

 

💻 何がうれしいのか

便利な機能がいろいろありますが、一つだけ必須な機能を挙げてみます。

例えば、Android Studio を開いてみます。

14インチ Mac Book Pro で、解像度はデフォルトです。

有料 Mac アプリ Bartender で何ができるのか

画面上部メニューバーには、利用しているアプリのメニューが表示されます。

Android Studio を開いてみます。

画面上部中央のカメラレンズのあるノッチをまたいでメニューバー幅の6~7割ほどが利用中のアプリである Android Studio のメニュー項目で占められてしまいます。

有料 Mac アプリ Bartender で何ができるのか

macOS 上で常駐で動いてるアプリのアイコンたちは、利用中の Android Studio のメニューたちで隠れてしまっています。

常駐アプリのアイコンを見る方法は、利用中のアプリを Finder などのメニュー数の少ないアプリに切り替えるしかありません。

これを Bartender を使うと、以下のようになります。

有料 Mac アプリ Bartender で何ができるのか

有料 Mac アプリ Bartender で何ができるのか

有料 Mac アプリ Bartender で何ができるのか
メニュー数の多い Android Studio を利用しながらでも隠れた常駐アプリアイコンをメニューバー下部に表示することができます。

有料 Mac アプリ Bartender で何ができるのか

 

💻 まとめ

似たような無料アプリはありますが、メニューバーの下に並列して表示できるアプリは見つけることができませんでしたので、今はこれがベストではないかと思っています。

常駐アプリのアイコンはいつでも確認できる状態にしておきたいです。

無料アプリあれば教えてください。

ソースがオープンであれば参考につくってみたいです。



gradle コマンドを補完しようとして brew にも補完があることを知る今さら感

 

👩‍💻 gradle/gradle-completion

本家から公開されてたんですね!

Gradle ./gradlew を補完しようとして brew の補完を知る今さら感

👉 gradle/gradle-completion: Gradle tab completion for bash and zsh hatena-bookmark

./gradlew でも利用できるようなのでインストールしてみました。


brew install gradle-completion

しかし、補完されないので調べる。


❯ brew info gradle-completion
...
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/share/zsh/site-functions
...


❯ ls /opt/homebrew/share/zsh/site-functions
_brew@     _gradle@   _lsd@      _starship@

手動でロードしてみると弾いてるが。


❯ source /opt/homebrew/share/zsh/site-functions/_gradle

_arguments:comparguments:327: can only be called from completion function
_tags:comptags:36: can only be called from completion function
_tags:comptry:55: can only be called from completion function
_tags:comptags:60: can only be called from completion function
_tags:comptags:67: can only be called from completion function

どうなってるんや。

 

👩‍💻 Basic installation doesn't work on macOS with zsh #95

issues にこんな。


if [ $commands[brew] ]
then
  fpath=("$(brew --prefix)/share/zsh/site-functions" $fpath)
fi

gradle-completion/issues/95#issuecomment-1165679687

見てみると FPATH にない。


❯ echo $FPATH | tr ':' '\n'
/opt/homebrew/share/zsh-completions
/usr/local/share/zsh/site-functions
/usr/share/zsh/site-functions
/usr/share/zsh/5.9/functions

ここに、gradle-completion のインストール先である


/opt/homebrew/share/zsh/site-functions

を追加すると補完は効き始めた。

 

👩‍💻 Homebrew Shell-Completion

さっきの解決方法の issue コメントに書いてあったページをみてみる。

To make Homebrew’s completions available in zsh, you must insert the Homebrew-managed zsh/site-functions path into your FPATH before initialising zsh’s completion facility. Add the following to your ~/.zshrc:


if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi

👉 brew Shell Completion — Homebrew Documentation hatena-bookmark

.zshrc に追加すると、brew コマンドでも TAB キーで補完が効き始める。


❯ brew i

info                  -- Display brief statistics for your Homebrew installa
install               -- Install a formula or cask
install-bundler-gems  -- Install Homebrew's Bundler gems
irb                   -- Enter the interactive Homebrew Ruby shell

知らんかった。

 

👩‍💻 まとめ

Homebrew のコマンド補完を以下で有効にしておくと、


# .zshrc
if type brew &>/dev/null
then
  FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"

  autoload -Uz compinit
  compinit
fi

Homebrew で以下にインストールされる補完スクリプトたちも、


❯ ls $(brew --prefix)/share/zsh/site-functions
_brew@     _gradle@   _lsd@      _starship@

インストール直後にそのまま使えるようになる。