LoginSignup
6
3

More than 5 years have passed since last update.

macOS Sierraで追加されたSF MonoにPowerlineのパッチを当てる

Last updated at Posted at 2016-09-24

始めに

macOS SierraからTerminalのデフォルトフォントがSF Monoに変更されました.

Screenshot 2016-09-25 05.15.54.png

なかなか見やすいのでこのまま使おうと思いましたが,Powerlineには対応していないので,自分の環境ではPromptが文字化けてしまう...

そのため,Powerlineのパッチを当てる手順を書いておきます.

手順

 
!!このコマンドは古い可能性が高いので,2016/12/06追加部分をご覧になることを推奨します!!

$ git clone https://github.com/powerline/fontpatcher

$ ./fontpatcher/scripts/powerline-fontpatcher /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/SFMono-Regular.otf

以上です.現在のディレクトリ内に'SF Mono Regular for Powerline.otf'が生成されているので

$ cp -f *Powerline ~/Library/Fonts

とかでコピーしてやるといいと思います.

あとはTerminalにフォントの設定をしてあげれば完了です.

前にRictyをパッチ当てた時はfontforgeやらが必要で面倒でしたが,簡単になってました


(2016/12/06追記)

コメントにて指摘があったので確認を行ったところ,

The required FontForge modules could not be loaded.
You need FontForge with Python bindings for this script to work.

というエラーメッセージが出てきてしまいました.その場合,以下のYVTさんのコメントにある

$ port install fontforge +python27

で,MacPortsを使いインストールすることでパッチをあてることができるそうです.

ご指摘ありがとうございました.

brewを使っている方は

$ brew install fontforge

で,fontforgeをインストールしたのち,

$ git clone https://github.com/powerline/fontpatcher
$ fontforge -lang=py -script ./fontpatcher/scripts/powerline-fontpatcher /Applications/Utilities/Terminal.app/Contents/Resources/Fonts/SFMono-Regular.otf

でパッチをあてることができました.ご参考になれば幸いです.

(2016/12/06追記終)


比較

Ricty
Screenshot 2016-09-25 05.01.42.png

SF Mono
Screenshot 2016-09-25 05.02.42.png

SF Monoの方が詰まってはいますが,なかなか読みやすいのではないでしょうか.

他の方法

以下のようにiTerm2を使えばパッチを当てなくてもPowerlineを文字化けせずに使えるみたいです.

以上です.ありがとうございました

6
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3