Setting up ohmyposh on VSCode, Terminal & Tabby on macOS

Setting up ohmyposh on VSCode, Terminal & Tabby on macOS

Table of Contents

A long time ago in a galaxy far, far away…

This post is over 12 months old, that's a long time in tech! Please be mindful of that when reading this post, young Padawan, as it could be outdated. I try to keep things up to date as much as possible. If you think something needs updating, please let me know in the comments.

Introduction

Ohmyposh is a custom prompt engine for any shell. It allows you to customise your prompt and make it look pretty! It is cross platform and works on Mac, Windows and Linux.

I had some issues getting it set up, primarily that I couldn’t get the images to show. It is a bit of a faff to set up, but it’s worth the effort. What’s really neat is once it is set up, it is available on all terminals and the configuration is consistent across all of them. The install approach will naturally differ depending on your operating system however, I expect that the configuration steps will be the same.

What does it look like?

The default prompt consists of a light orange segment that shows the user, a darker orange segment that has a folder icon and the name of the directory you are in and a blue segment with a tick that means that the previous command was successful (it will become a red block with a cross if the previous command was invalid).

Here it is in Terminal:

The image shows the native macOS terminal running zsh, the prompt is presenting the default ohmyposh theme as described above.

Here it is in my preferred terminal Tabby:

The image shows the native Tabby terminal running powershell, the prompt is presenting the default ohmyposh theme as described above. I ran an invalid command and the final segment is filled red and a white cross.

Here it is in vscode:

The image shows the vscode integrated terminal running zsh, the prompt is presenting the default ohmyposh theme as described above. There is an additional segment included because I have a directory open within a git repository, the additional segment is light orange, shows a git icon, the name of the branch I have open and a few additional icons that I have not yet learnt about!

Install ohmyposh

Full details on the ohmyposh site. Installing via command line is the simplest way;

# mac
brew install jandedobbeleer/oh-my-posh/oh-my-posh
# windows
winget winget install JanDeDobbeleer.OhMyPosh -s winget

The next step is to install a nerd font. Nerd fonts are fonts that have additional glyphs that are used by ohmyposh to display icons.

Previous Install Fonts steps

10/12/2023 note: I have run through this today to install ohmyposh on Windows Vm and discovered that there is a simpler way to install fonts and it works across platform! If you want to manually install read on, otherwise skip to next section.

To prepare brew, you need to run the following command once;

brew tap homebrew/cask-fonts # this only needs running once

There are many nerd fonts available, you can search for them using this command;

brew search nerd-font

This will return a list of fonts that you can install;

image shows a list of roughly sixty fonts returned by the command

Ohmyposh recommends Meslo LGM NF, but I prefer CaskaydiaCove. To install it, run the following command;

brew install --cask font-caskaydia-cove-nerd-font

So now you have ohmyposh installed and a nerd font installed, next step is to configure the terminals to use the nerd font you have installed…

Install fonts

You can install fonts via ohmyposh:

oh-my-posh font install

This will download and install your chosen font. I have installed CascadiaCode the output confirms the fonts that have been installed.

Visual studio code terminal is open, the output says  Successfully installed CascadiaCode, the following font families are now available for configuration, CaskaydiaCove Nerd Font Mono, CaskaydiaCove Nerd Font, CaskaydiaCove Nerd Font Propo

Set terminals to use nerd fonts

Terminal

Open terminal and go to preferences. Select the profiles tab and in the text section click the change button next to the Font selection:

image shows the preferences window with the profiles tab selected and the text section selected. The change button is highlighted.

Another window will appear with a list of fonts. If you click on All Fonts and from there you can choose CaskaydiaCove Nerd Font:

the image shows a font selection window with the All Fonts option selected and CaskaydiaCove Nerd Font highlighted.

vscode

Open the settings window and search for the term familyfont. The option to change is Terminal > Integrated: Font Family and you need to change it to CaskaydiaCove NFM;

image shows the vscode settings, the search bar has fontfamily input and Terminal > Integrated: Font Family has been updated to CaskaydiaCove NFM

Note that this was the primary reason that the glyphs weren’t working. From what I understand, there are specific versions that are going to work with vscode, make sure that you have correctly entered the version as written above.

I don’t think you have to set the GPU acceleration option. It was suggested in one of the troubleshooting posts. The description of the option says “Controls whether the terminal will leverage the GPU to do its rendering” so I have set it to auto either way. You can find the option by searching for the term “acceleration” in the search bar. The option is Terminal > Integrated: Gpu Acceleration;

image shows the vscode settings, the search bar has accelerator input, and Integrated: Gpu Acceleration has been updated to auto

Tabby

Open preferences in Tabby and go to the appearance section, set the font to CaskaydiaCove NFM and turn on Enable font ligatures;

image shows the vscode settings, the search bar has accelerator input, and Integrated: Gpu Acceleration has been updated to auto

Configure your prompt

Next step is to configure your prompt(s). This differs depending on which shell(s) you use, refer to the ohmyposh documentation for details. Choose which shell(s) you want to configure and follow the instructions.

image shows the ohmyposh prompt page, there is a menu of different shells to select, underneath the menu is the description for how to configure the selected shell

Once you have run through the prompt guidance the ohmyprompt theme should appear in any terminal you have configured. Note that you may need to restart the application to get the prompt to appear.

What next?

Now you have ohmyposh installed and configured, you can stop there. But you can pick a different theme…you can see them all on the ohmyposh site. You can even have a bash at making your own!

#mtfbwy



Recent Posts