📝

Homebrew-sfmono-squareのインストールでこけたけど、解決した話

2022/12/20に公開約5,100字1件のコメント

読者の対象

  • 使用するフォントに迷っている方
  • Homebrew-sfmono-squareのアップデートができない人

導入

Homebrew-sfmono-squareというフォントを知っていますか?

https://github.com/delphinus/homebrew-sfmono-square

SF Mono is a font from Apple, that is clear, easy to read, and suitable for programming. SFMono Square is based on SF Mono, and added glyphs for Japanese & patched for Nerd Fonts.

このフォントの特徴は、半角2文字分が全角1文字分として表示されるため、コードが見やすく、カーソル移動がしやすいことです。
現在、VS Code から Neovim へ移行しようとしていた私は、Homebrew-sfmono-square のアップデートがあることに気づいたので、アップデートを実行しました。

問題

Font forgeを読み込むことができず、インストールできない問題が発生しました。

$ brew install sfmono-square
==> Fetching delphinus/sfmono-square/sfmono-square
==> Downloading https://osdn.net/projects/mix-mplus-ipa/downloads/72511/migu-1m-20200307.zip
Already downloaded: /Users/user_name/Library/Caches/Homebrew/downloads/2037f106747069ba730e62150637c6fff744a1323bfaaf3c55d78862f8c880ba--migu-1m-20200307.zip
==> Downloading https://developer.apple.com/design/downloads/SF-Mono.dmg
Already downloaded: /Users/user_name/Library/Caches/Homebrew/downloads/0460e0518bf6a1c4bf8645a32eab811d8aef26f6e7a24fb44d81e4a237d7afd4--SF-Mono.dmg
==> Downloading https://github.com/delphinus/homebrew-sfmono-square/archive/v2.1.0.tar.gz
Already downloaded: /Users/user_name/Library/Caches/Homebrew/downloads/553fca0d27526b37ffbf547d710721df67d72102f5295a09b31a6db407fcc5ed--homebrew-sfmono-square-2.1.0.tar.gz
==> Installing sfmono-square from delphinus/sfmono-square
==> /usr/bin/xar -xf SF Mono Fonts.pkg
==> /bin/bash -c cat SFMonoFonts.pkg/Payload | gunzip -dc | cpio -i
==> /usr/local/opt/python@3.11/bin/python3.11 -c import sys
sys.path.append('/private/tmp/sfmono-square-20221219-99451-1xoyes0/homebrew-sfmono-square-2.1.0/src')
sys.path.append('/usr/local/opt/fon
Last 15 lines from /Users/user_name/Library/Logs/Homebrew/sfmono-square/03.python3.11:
/usr/local/opt/python@3.11/bin/python3.11
-c
import sys
sys.path.append('/private/tmp/sfmono-square-20221219-99451-1xoyes0/homebrew-sfmono-square-2.1.0/src')
sys.path.append('/usr/local/opt/fontforge/lib/python3.11/site-packages')
import build
sys.exit(build.build('2.1.0'))

Traceback (most recent call last):
File "<string>", line 4, in <module>
File "/private/tmp/sfmono-square-20221219-99451-1xoyes0/homebrew-sfmono-square-2.1.0/src/build.py", line 5, in <module>
import font_patcher
File "/private/tmp/sfmono-square-20221219-99451-1xoyes0/homebrew-sfmono-square-2.1.0/src/font_patcher.py", line 6, in <module>
import fontforge
ModuleNotFoundError: No module named 'fontforge'

Do not report this issue to Homebrew/brew or Homebrew/core!

fontforge が読み込めないようなので、再インストールを行う。
さらに、リンクを行う。

$ brew reinstall fontforge
Warning: Treating fontforge as a formula. For the cask, use homebrew/cask/fontforge
==> Fetching fontforge
==> Downloading https://ghcr.io/v2/homebrew/core/fontforge/manifests/20220308_1-2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/fontforge/blobs/sha256:06a77e255751a88fd8d7e0f48b6f19c5689aae22ad6570c0f6a9501f3ea2dcbe
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:06a77e255751a88fd8d7e0f48b6f19c5689aae22ad6570c0f6a9501f3ea2dcbe?se=2022-12-19T01%3A20%3A00Z&sig=RjHY7XUhCxyhAXL
######################################################################## 100.0%
==> Reinstalling fontforge 
==> Pouring fontforge--20220308_1.monterey.bottle.2.tar.gz
:beer: /usr/local/Cellar/fontforge/20220308_1: 429 files, 14.9MB
==> Running `brew cleanup fontforge`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
$ brew unlink fontforge && brew link fontforge
Unlinking /usr/local/Cellar/fontforge/20220308_1... 55 symlinks removed.
Linking /usr/local/Cellar/fontforge/20220308_1... 55 symlinks created.

最後に、sfmono-square をインストールしたら、フォントをインストールすることができました!

$ brew install sfmono-square
==> Fetching delphinus/sfmono-square/sfmono-square
==> Downloading https://osdn.net/projects/mix-mplus-ipa/downloads/72511/migu-1m-20200307.zip
Already downloaded: /Users/user_name/Library/Caches/Homebrew/downloads/2037f106747069ba730e62150637c6fff744a1323bfaaf3c55d78862f8c880ba--migu-1m-20200307.zip
==> Downloading https://developer.apple.com/design/downloads/SF-Mono.dmg
Already downloaded: /Users/user_name/Library/Caches/Homebrew/downloads/0460e0518bf6a1c4bf8645a32eab811d8aef26f6e7a24fb44d81e4a237d7afd4--SF-Mono.dmg
==> Downloading https://github.com/delphinus/homebrew-sfmono-square/archive/v2.1.0.tar.gz
Already downloaded: /Users/user_name/Library/Caches/Homebrew/downloads/553fca0d27526b37ffbf547d710721df67d72102f5295a09b31a6db407fcc5ed--homebrew-sfmono-square-2.1.0.tar.gz
==> Installing sfmono-square from delphinus/sfmono-square
==> /usr/bin/xar -xf SF Mono Fonts.pkg
==> /bin/bash -c cat SFMonoFonts.pkg/Payload | gunzip -dc | cpio -i
==> /usr/local/opt/python@3.11/bin/python3.11 -c import sys
sys.path.append('/private/tmp/sfmono-square-20221219-1800-1cz8tdj/homebrew-sfmono-square-2.1.0/src')
sys.path.append('/usr/local/opt/font

Discussion

Thanks!

ログインするとコメントできます