20201024のMacに関する記事は3件です。

秋の dotfiles 大掃除【Alacritty編】

AlacrittyはRust製のターミナルエミュレータで、GPUを利用することで高速なレンダリングを実現しています。macOS、Linux、Windows、BSDなどの主要なOSで使用できます。

環境

  • macOS Catalina 19.15.7
  • Rust 1.47.0(stable)

インストール

macOSにAlacrittyをインストールする方法は3つあります。

  • ソースコードからビルドする
  • Homebrewでインストール
  • cargoでインストール

Homebrewcargoでインストールする場合、 terminfo fileやdesktop entry、manual page、 シェル補完を利用できなくなりますが、Rustの環境を構築する必要がなく(cargoを利用する場合は必要)、簡単にAlacrittyをインストールできます。
詳しくはマニュアルインストールを確認してください。

ソースコードからビルド

1. Rustの環境を構築する

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

2. リポジトリからソースコードをクローンする

git clone https://github.com/alacritty/alacritty.git
cd alacritty

3. AlacrittyをコンパイルするRustのバージョンを指定する

rustup override set stable
rustup update stable

4. Alacrittyのビルドとインストール

make app
cp -r target/release/osx/Alacritty.app /Applications/

Homebrewでインストール

HomebrewでAlacrittyをインストールする

brew cask install alacritty

cargoでインストール

1. Rustの環境を構築する

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

2. cargoでAlacrittyをインストールする

cargo install alacritty

設定

設定ファイルの優先順位

  1. $XDG_CONFIG_HOME/alacritty/alacritty.yml
  2. $XDG_CONFIG_HOME/alacritty.yml
  3. $HOME/.config/alacritty/alacritty.yml
  4. $HOME/.alacritty.yml

Alacrityは上記の順番で設定ファイルが読み込まれます。
macOSの場合、デフォルトでは$XDG_CONFIG_HOMEは設定されていないので$HOME/.config/alacritty/alacritty.yml$HOME/.alacritty.ymlが読み込まれるでしょう。
今回は$HOME/.config/alacritty/alacritty.ymlに設定を記述します。

設定ファイル

$HOME/.config/alacritty/alacritty.yml
shell:
  program: /usr/local/bin/fish
  args:
    - --login
    - --command
    - "tmux attach || tmux"
# テーマ
colors:
  primary:
    background: '#32302f'
    foreground: '#ebdbb2'
  normal:
    black:   '#282828'
    red:     '#cc241d'
    green:   '#98971a'
    yellow:  '#d79921'
    blue:    '#458588'
    magenta: '#b16286'
    cyan:    '#689d6a'
    white:   '#a89984'
  bright:
    black:   '#928374'
    red:     '#fb4934'
    green:   '#b8bb26'
    yellow:  '#fabd2f'
    blue:    '#83a598'
    magenta: '#d3869b'
    cyan:    '#8ec07c'
    white:   '#ebdbb2'
# フォント
font:
  size: 12  # フォントサイズ
  normal:
    family: 'Source Code Pro'
    style: Regular
  bold:
    family: 'Source Code Pro'
    style: Bold
  italic:
    family: 'Source Code Pro'
    style: Italic
  bold_italic:
    family: 'Source Code Pro'
    style: Bold Italic
window:
  decorations: full         # ボーダーとタイトルバーを表示する
  startup_mode: Fullscreen  # フルスクリーンで起動する
background_opacity: 0.95    # 背景を透過させる

fish shellとtmuxを使用しているので、shellでAlacritty起動時にfish shellを使用して、tmuxのセッションが残っていた場合セッションにアタッチし、残っていなかった場合tmuxを実行するように指定しています。
colorsではAlacrittyのテーマを指定できます。上記の設定ファイルではGruvboxのカラースキームを指定していますが、Color schemes · alacritty/alacritty WikiでAlacritty用のカラースキームが公開されています。
fontでは、フォントサイズと使用するフォントを指定しています。Souce Code ProはAdobeが開発したプログラミング用フォントでPowerlineフォントとしても利用できます。
windowbackground_opacityでは、Alacrittyの見た目を変えています。

その他の設定はconfig-alacritty/alacritty.yml at master · tmcdonell/config-alacrittyを参考にすると良いでしょう。

tmux, NeovimでTrue colorを有効にする

Alacrittyで、tmux、NeovimのTrue colorを有効にするにはAlacrittyとtmuxの設定が必要です。以下の設定をそれぞれの設定ファイルに追加しましょう。

$HOME/.config/alacritty/alacritty.yml
env:
  TERM: alacritty
$HOME/.tmux.conf
set -g default-terminal "screen-256color"
set-option -sa terminal-overrides ',alacritty:RGB'

Support "True" (24-bit) color · Issue #109 · alacritty/alacritty


参考サイト

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

Big Sur BetaでParallels Desktopのネットワークが接続できない問題を回避する方法

Big Surを先走ってBeta版インストールしたんですが、Parallels立ち上げると「ネットワークが起動できません?」とか言われるので暫定的な回避方法。

?

sudo -b /Applications/Parallels\ Desktop.app/Contents/MacOS/prl_client_app

参考
https://forum.parallels.com/threads/network-initialization-failed.345647/page-4

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

catalinaにした途端git pullができなくなった

git pullしたら、

git: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
git: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

とかでた。

ああ、最近MacのOSアプデしたなと。

色々やったのですが、そもそもXcodeがインストールされてなかったので、
AppStoreからXcodeをインストールしたら治りました。

  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む