---
title: "ターミナルがダサいとモテない。Starship 紹介編 | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/terminal-starship/"
description: "Starship をお使いですか？ Photo by Andy Hermawan on Unsplash 恵比寿で IT 企業をやっているとモテると聞いて創業しましたが早いことありがたいことに10年目に突入した長谷川です。 まだモテる成果は出ていません、、、これからです！（3回目） 最近、歳なのか夜が眠れません・・・…"
---

# ターミナルがダサいとモテない。Starship 紹介編

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2024年6月12日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#シリーズ: ターミナル環境](/tags/シリーズ-ターミナル環境/)[#starship](/tags/starship/)[#terminal](/tags/terminal/)

![ターミナルがダサいとモテない。Starship 紹介編](/_astro/hero.Cau0P_Y2_ZhzIBq.webp)

Starship をお使いですか？

![ターミナルがダサいとモテない。Starship 紹介編（1）](/_astro/01-0-r9QRMspUe8f4_HkY-a5ba6c3e.BSC8l3q2_Z147Kak.webp)

Photo by [Andy Hermawan](https://unsplash.com/@kolamdigital?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com/?utm_source=medium&utm_medium=referral)

恵比寿で IT 企業をやっているとモテると聞いて創業しましたが早いことありがたいことに10年目に突入した長谷川です。

まだモテる成果は出ていません、、、これからです！（3回目）

最近、歳なのか夜が眠れません・・・  
眠れない夜にスマホアプリで少しずつ書いているのがあるので公開していきます。

> **シリーズ記事一覧**
> 
> -   [ターミナルがダサいとモテない。Terminal Emulator 紹介編](https://blog.grasys.io/post/yusukeh/terminal-emulator-macos/)
>     
> -   [ターミナルがダサいとモテない。WezTerm 紹介編](https://blog.grasys.io/post/yusukeh/terminal-wezterm/)
>     
> -   [ターミナルがダサいとモテない。tmux + tpm 紹介編](https://blog.grasys.io/post/yusukeh/terminal-tmux-tpm/)
>     
> -   [ターミナルがダサいとモテない。Dracula Theme 紹介編](https://blog.grasys.io/post/yusukeh/terminal-dracula-theme/)
>     
> -   [ターミナルがダサいとモテない。neovim + AstroNvim 紹介編](https://blog.grasys.io/post/yusukeh/terminal-neovim-astronvim/)
>     
> -   [ターミナルがダサいとモテない。モダンなコマンド 紹介編](https://blog.grasys.io/post/yusukeh/terminal-modern-command/)
>     

## Starship

自分は mac の中で Bash の Command-Line Framework の [rerun](https://rerun.github.io/rerun/) を使っているため、zsh に移行できてません  
rerun には macOS の設定やら業務上で利用する Script などを登録しているので無くすのがとても難しい・・・  
かといって Shell でできることを Python の Typer とかで置き換えるのもちょっと・・・

Prompts をいじって見た目を工夫したり、もう何年前だろうか・・・  
20年前くらいにこだわってた若かりし頃がありますが今なら Starship で一発ですね。

Starship の特徴（ざっくり）

-   Rust で書かれている
    
-   めちゃくちゃカスタマイズできる
    
-   CWD の状態を表示できる。
    
-   どんな Shell でもどの OS でも動く
    
-   Config も体系化されてて簡単[](https://starship.rs/?source=post_page-----35c906a3a6f4--------------------------------)
    

[Starship: Cross-Shell Prompt](https://starship.rs/?source=post_page-----35c906a3a6f4--------------------------------)

慣れると他のホストでちょっとさみしく感じるくらい見た目が派手です。

![Starshipの画面](/_astro/02-1-IxJzOuQpH8VnILYW1A1uVw-946e5b4d.BliwBayh_26iSk4.webp)

Starship

ちなみにこの System Infomation は [neofetch](https://github.com/dylanaraps/neofetch) です。

普通に mac の homebrew にあります。[](https://github.com/dylanaraps/neofetch?source=post_page-----35c906a3a6f4--------------------------------)

[GitHub - dylanaraps/neofetch: 🖼️ A command-line system information tool written in bash 3.2+](https://github.com/dylanaraps/neofetch?source=post_page-----35c906a3a6f4--------------------------------)

## Install Nerd Fonts

まず Nerd Fonts を Install する必要があります。[](https://www.nerdfonts.com/?source=post_page-----35c906a3a6f4--------------------------------)

[Nerd Fonts - Iconic font aggregator, glyphs/icons collection, & fonts patcher](https://www.nerdfonts.com/?source=post_page-----35c906a3a6f4--------------------------------)

こちらも以下のコマンドで homebrew から Install できます。

tap で `homebrew/cask-fonts` を有効化します。  
以下の例では Hack Nerd Font を入れています。

Plain textcontent\_copy

```
brew tap homebrew/cask-fonts
brew install font-hack-nerd-font
```

[GitHub - ryanoasis/nerd-fonts: Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+…](https://github.com/ryanoasis/nerd-fonts?source=post_page-----35c906a3a6f4--------------------------------)

nerd-fonts は好みで良いかと

github monaspace[](https://monaspace.githubnext.com/?source=post_page-----35c906a3a6f4--------------------------------)

[Monaspace](https://monaspace.githubnext.com/?source=post_page-----35c906a3a6f4--------------------------------)

moralerspace

自分はこちらを利用しています。[](https://github.com/yuru7/moralerspace?source=post_page-----35c906a3a6f4--------------------------------)

[GitHub - yuru7/moralerspace: Moralerspace は、欧文フォント Monaspace と日本語フォント IBM Plex Sans JP…](https://github.com/yuru7/moralerspace?source=post_page-----35c906a3a6f4--------------------------------)

HackGen[](https://github.com/yuru7/HackGen?source=post_page-----35c906a3a6f4--------------------------------)

[GitHub - yuru7/HackGen: Hack と源柔ゴシックを合成したプログラミングフォント 白源 (はくげん／HackGen)](https://github.com/yuru7/HackGen?source=post_page-----35c906a3a6f4--------------------------------)

## Install Starship

Starship も homebrew にあります。

以下のコマンドで Install できます。

Plain textcontent\_copy

```
brew install starship
```

## Setup shell

### bash

bash なら以下のように **`~/.bashrc`** などに設定してください。

Plain textcontent\_copy

```
if command -v starship &> /dev/null; then
  eval "$(starship completions bash)"
  eval "$(starship init bash)"
fi
```

zsh

自分は zsh を利用していないので [Official](https://starship.rs/guide/#step-2-set-up-your-shell-to-use-starship) を参考に[](https://starship.rs/guide/?source=post_page-----35c906a3a6f4--------------------------------#step-2-set-up-your-shell-to-use-starship)

[Starship: Cross-Shell Prompt](https://starship.rs/guide/?source=post_page-----35c906a3a6f4--------------------------------#step-2-set-up-your-shell-to-use-starship)

## Configuration

ここからが設定です。

starship のサブコマンドには **print-config** がありそれを使うことで default の設定を出力できます。

まず以下のコマンドで default 設定を出力しちゃいましょう！

Plain textcontent\_copy

```
test ! -d ${HOME}/.config && mkdir ${HOME}/.config
test ! -f ${HOME}/.config/starship.toml && starship print-config --default > ${HOME}/.config/starship.toml
```

Document はこちらです。[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------)

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------)

## Prompt

ここから詳細な設定に入ります。自分の変更している箇所を説明していきます。

まずは、Prompt の設定です。[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#prompt)

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#prompt)

自分の Starship の Prompt はこんな感じです。

Apple Color Emoji を普通に使ってしまっていますが、問題は発生してません。  
発生したら Nerd Font に切り替えますw

![Promptの写真](/_astro/03-1-ul7qhTbMl9XEkj-7_OkpXQ-4f8db537.Bql_Qgtx_Z1SFQXJ.webp)

starship prompt

以下のこれらだけそれぞれの設定において色付けや表示面のカスタマイズをしています。

-   $username
    
-   $os
    
-   $hostname
    
-   $memory\_usage
    
-   $time
    
-   $battery
    
-   $directory
    
-   $cmd\_duration
    

Pastel Powerline Preset を使っていて、配色を Dracula に合わせています。

当たり前だけど、残念ながら Nerd Fonts の記号がこの HTML で表現できず・・・😅

Plain textcontent\_copy

```
format = """
[](#9A348E)$username$os$hostname$localip[](fg:#9A348E bg:#DA627D)$memory_usage[](fg:#DA627D bg:#FCA17D)$time[](fg:#FCA17D bg:#06969A)$battery[](fg:#06969A bg:#33658A)$directory[](fg:#33658A bg:#86BBD8)$cmd_duration[ ](fg:#86BBD8)\
$shell$shlvl$singularity$kubernetes$vcsh$fossil_branch$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch$pijul_channel$docker_context$package$bun$c$cmake$cobol$daml$dart$deno$dotnet$elixir$elm$erlang$fennel$golang$gradle$haskell$haxe$helm$java$julia$kotlin$lua$nim$nodejs$ocaml$opa$perl$php$pulumi$purescript$python$raku$rlang$red$ruby$rust$scala$solidity$swift$terraform$vlang$vagrant$zig$buf$guix_shell$nix_shell$conda$meson$spack$aws$gcloud$openstack$azure$direnv$env_var$crystal$custom$sudo$line_break$jobs$status$container$character
"""
```

[Starship: Cross-Shell Prompt](https://starship.rs/presets/pastel-powerline.html?source=post_page-----35c906a3a6f4--------------------------------)

$username

Plain textcontent\_copy

```
[username]
format = "[$user ]($style)"
style_root = "bg:#9A348E"
style_user = "bg:#9A348E"
show_always = true
disabled = false
```

[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#username)[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#username)

$os

Plain textcontent\_copy

```
[os]
format = "[$symbol]($style)"
style = "bg:#9A348E"
disabled = false
```

print-config で出力された toml を見ると、いろいろな OS の Icon が設定されているのでちょっと楽しいです。

![ターミナルがダサいとモテない。Starship 紹介編（2）](/_astro/04-1-1p9dNboR4NmWNwL_pQUwtg-fb0acc35.CbG21Uy6_xXwao.webp)

Starship $os.symbols

[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#os)[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#os)

$hostname

Plain textcontent\_copy

```
[hostname]
ssh_only = false
ssh_symbol = "🌐"
trim_at = "."
detect_env_vars = []
format = "[$ssh_symbol$hostname ]($style)"
style = "bg:#9A348E"
disabled = false
```

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#hostname)

$memory\_usage

Plain textcontent\_copy

```
[memory_usage]
threshold = -1
format = "[$symbol$ram_pct ]($style)"
style = "bg:#DA627D"
symbol = "🧛 "
disabled = false
```

[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#memory-usage)

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#memory-usage)

$time

Plain textcontent\_copy

```
[time]
format = "[ 🕒 $time ]($style)"
style = "fg:#191970 bg:#FCA17D"
use_12hr = false
time_format = "%T"
disabled = false
utc_time_offset = "local"
time_range = "-"
```

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#time)

$battery

Plain textcontent\_copy

```
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "🪫"
unknown_symbol = "❓ "
empty_symbol = "🧟 "
disabled = false
format = "[ $symbol$percentage ]($style)"

[[battery.display]]
threshold = 100
style = "bg:#06969A"

[[battery.display]]
threshold = 30
style = "bg:#06969A"
discharging_symbol = "💦"
```

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#battery)

$directory

Plain textcontent\_copy

```
[directory]
truncation_length = 3
truncate_to_repo = true
fish_style_pwd_dir_length = 0
use_logical_path = true
format = "[ 📁 $path ]($style)[$read_only]($read_only_style)"
repo_root_format = "[ $before_root_path ]($before_repo_root_style)[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style)"
style = "bg:#33658A"
disabled = false
read_only = "🔒"
read_only_style = "red"
truncation_symbol = ".../"
home_symbol = "~"
use_os_path_sep = true
```

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#directory)

$cmd\_duration

Plain textcontent\_copy

```
[cmd_duration]
min_time = 2000
format = "[ 🐢 $duration ]($style)"
style = "fg:#DA627D bold bg:#86BBD8"
show_milliseconds = false
disabled = false
show_notifications = false
min_time_to_notify = 5000
```

🐢入れてますw[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#command-duration)

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#command-duration)

git の directory などでプロンプトに状態がでるので便利です。[](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#git-branch)

[Starship: Cross-Shell Prompt](https://starship.rs/config/?source=post_page-----35c906a3a6f4--------------------------------#git-branch)

先日の Update で Direnv も取り込まれました。[](https://github.com/starship/starship/commit/1082afce0a27c5459d25998ea137067eb44dadab?source=post_page-----35c906a3a6f4--------------------------------)

[chore(master): release 1.17.1 (#5670) · starship/starship@1082afc](https://github.com/starship/starship/commit/1082afce0a27c5459d25998ea137067eb44dadab?source=post_page-----35c906a3a6f4--------------------------------)

Starship は邪魔になったら `.bashrc` の設定ですぐ外せるし、ちょっと見た目が知らない人からすると「おっ！」ってなると思うのでオススメw

（ただし Remote と macOS Local の表示の違いが気持ち悪さに繋がります・・・）

他にもシリーズ記事を書いているので、よろしければご覧ください！

> **シリーズ記事一覧**
> 
> -   [ターミナルがダサいとモテない。Terminal Emulator 紹介編](https://blog.grasys.io/post/yusukeh/terminal-emulator-macos/)
>     
> -   [ターミナルがダサいとモテない。WezTerm 紹介編](https://blog.grasys.io/post/yusukeh/terminal-wezterm/)
>     
> -   [ターミナルがダサいとモテない。tmux + tpm 紹介編](https://blog.grasys.io/post/yusukeh/terminal-tmux-tpm/)
>     
> -   [ターミナルがダサいとモテない。Dracula Theme 紹介編](https://blog.grasys.io/post/yusukeh/terminal-dracula-theme/)
>     
> -   [ターミナルがダサいとモテない。neovim + AstroNvim 紹介編](https://blog.grasys.io/post/yusukeh/terminal-neovim-astronvim/)
>     
> -   [ターミナルがダサいとモテない。モダンなコマンド 紹介編](https://blog.grasys.io/post/yusukeh/terminal-modern-command/)
>     

転載：[ターミナルがダサいとモテない。Starship 紹介編（Medium）](https://medium.com/@yusuke_h/%E3%82%BF%E3%83%BC%E3%83%9F%E3%83%8A%E3%83%AB%E3%81%8C%E3%83%80%E3%82%B5%E3%81%84%E3%81%A8%E3%83%A2%E3%83%86%E3%81%AA%E3%81%84-starship%E7%B4%B9%E4%BB%8B%E7%B7%A8-35c906a3a6f4)

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [X](https://x.com/yusukeh "X")
-   [GitHub](https://github.com/yusukeh "GitHub")
-   [Medium](https://medium.com/@yusukeh "Medium")
-   [Facebook](https://www.facebook.com/yusuke.exzm "Facebook")
-   [Instagram](https://www.instagram.com/yusukehasegawa/ "Instagram")
-   [LinkedIn](https://www.linkedin.com/in/hasegawa-yusuke-091b4164/ "LinkedIn")

[プロフィールと記事一覧](/authors/yusukeh/)
