2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ZshとPrezto: あなたのターミナル環境をアップグレードする完全ガイド(環境構築メモ)

Last updated at Posted at 2023-05-12

初めに

本稿では、ターミナル環境であるZshとその設定フレームワークPreztoのインストールと設定方法についてのメモを残す。この2つのツールは、コマンドライン操作をより効率的に行うための重要なツールである。

Zshは、Bashと並ぶ人気のシェルの一つで、機能的で拡張性のある特性を持つ。その豊富な機能とカスタマイズ性を活かすための設定フレームワークとして、Preztoが存在する。

筆者の環境

  • ubuntu22.04
  • mac(M1) → Preztoのインストールから作業開始

zshのinstall

Zshのインストール方法を説明する。端末を開き、次のコマンドを実行する。

sudo apt update
sudo apt install zsh

このコマンドにより、Zshがインストールされる。次に、デフォルトのシェルをZshに変更するためのコマンドを実行する。

---------------
webarenaのubuntuの場合
sudo passwd ubuntu
New password:<任意のpassworを入力>
Retype new password:<再度任意のpassworを入力>
---------------

chsh -s $(which zsh)

システムを再起動し、デフォルトのシェルがZshに変更されていることを確認する。

echo $SHELL

出力結果が /usr/bin/zsh または /bin/zsh のようになっていれば、Zshのインストールは成功であると言い切ることができる。

Preztoのインストール

次に、Preztoのインストール方法を説明する。まず、Zshを起動し、次のコマンドを実行する。

#gitがなければ
sudo apt install git
#macの場合
brew install git

#Preztoのインストール
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

このコマンドにより、Preztoのリポジトリがクローンされる。次に、設定ファイルを作成またはリンクするためのコマンドを実行する。

setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
  ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

Zshを再起動する。

最後に

以上の手順により、Preztoのインストールが完了する。Preztoの設定は ~/.zpreztorc ファイルで行うことができる。利用者の好みに合わせて設定をカスタマイズすることが可能である。

2
0
0

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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?