How to appear your custom hostname in iTerm + p10k + oh-my-zsh

vincentjang

Vincent Jang

Posted on March 12, 2022

How to appear your custom hostname in iTerm + p10k + oh-my-zsh

Recently, I re-learned about VIM, So I want to customize my terminal.

Actually, I already used a terminal iTerm with Oh-My-Zsh
But when I installed and set powerlevel10k, and something occurred.

Image description

HostName is missing.... :(

So I decided to bring missing hostname again.

Step 1 : Edit ~/.p10k.zsh

I used Vim for edit.
You can easily find POWERLEVEL9K_LEFT_PROMPT_ELEMENTS
Just insert host in POWERLEVEL9K_LEFT_PROMPT_ELEMENTS where you want.

vim ~/.p10k.zsh

# in .p10k.zsh
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
    os_icon                 # os identifier
    host                    # hostname
    dir                     # current directory
    vcs                     # git status
    prompt_char             # prompt symbol
  )

Enter fullscreen mode Exit fullscreen mode

Step2 : customize hostname.

Note : Customize hostname may cause unexpected side effects.

scutil --set HostName
HostName: #input hostname you want
Enter fullscreen mode Exit fullscreen mode

Step3 : Confirm result

source ~/.p10k.zsh
Enter fullscreen mode Exit fullscreen mode

Image description

I successfully done.

I think is silly problem, but It really bother me..
I hope it will help people who wander like me.

Thank you for reading.

πŸ’– πŸ’ͺ πŸ™… 🚩
vincentjang
Vincent Jang

Posted on March 12, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related