--- id: installation title: Manual Installation sidebar_label: Manual Installation --- import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; ### 1. Setup your terminal Oh my Posh uses ANSI color codes under the hood, these should work everywhere, but you may have to set `$TERM` to `xterm-256color` for it to work. :::caution Font icons For maximum enjoyment, make sure to **install** and **configure** your terminal to use a powerline enabled font. The fonts we use are patched by [Nerd Fonts][nerdfonts], which offer a maximum of icons you can use to configure your prompt. ::: Oh my Posh was designed using [Meslo LGM NF][meslo], so if you happen to see missing icons either change to that font or replace the icons by changing the [theme][themes] to your liking. ### 2. Download the latest binary If you're looking to use the shell in PowerShell, there's a [PowerShell package][powershell] for your enjoyment that facilitates the whole process. But, if you insist on doing it manually, or you use a pre-core version of PowerShell, here you go :-) ```powershell mkdir C:\tools Invoke-Webrequest https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-windows-amd64.exe -OutFile C:\tools\oh-my-posh.exe ``` ```bash wget https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-darwin-amd64 -O /usr/local/bin/oh-my-posh chmod +x /usr/local/bin/oh-my-posh ``` ```bash wget https://github.com/JanDeDobbeleer/oh-my-posh3/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh chmod +x /usr/local/bin/oh-my-posh ``` ### 3. Download a theme Find a [theme][themes] you like, download it and store it somewhere you can find it again. ### 4. Replace your existing prompt Edit `$PROFILE` in your preferred PowerShell version and add the following lines. ```powershell [ScriptBlock]$Prompt = { $realLASTEXITCODE = $global:LASTEXITCODE & "C:\tools\oh-my-posh.exe" -config "~/downloadedtheme.json" -error $realLASTEXITCODE -pwd $PWD $global:LASTEXITCODE = $realLASTEXITCODE Remove-Variable realLASTEXITCODE -Confirm:$false } Set-Item -Path Function:prompt -Value $Prompt -Force ``` Add the following to `~/.zshrc`: ```bash function powerline_precmd() { PS1="$(oh-my-posh -config ~/downloadedtheme.json --error $?)" } function install_powerline_precmd() { for s in "${precmd_functions[@]}"; do if [ "$s" = "powerline_precmd" ]; then return fi done precmd_functions+=(powerline_precmd) } if [ "$TERM" != "linux" ]; then install_powerline_precmd fi ``` Add the following to `~/.bashrc` (or `~/.profile` on MacOS): ```bash function _update_ps1() { PS1="$(oh-my-posh -config ~/downloadedtheme.json -error $?)" } if [ "$TERM" != "linux" ] && [ -x "$(command -v oh-my-posh)" ]; then PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi ``` When using `nix-shell --pure`, `oh-my-posh` will not be accessible, and your prompt will not appear. As a workaround you can add this snippet to `~/.bashrc`, which should re-enable the prompt in most cases: ```bash # Workaround for nix-shell --pure if [ "$IN_NIX_SHELL" == "pure" ]; then if [ -x oh-my-posh ]; then alias powerline-go="oh-my-posh -config ~/downloadedtheme.json" fi fi ``` Redefine `fish_prompt` in `~/.config/fish/config.fish`: ```bash function fish_prompt eval oh-my-posh -config ~/downloadedtheme.json -error $status end ``` Make sure `~/downloadedtheme.json` points to your downloaded or adjusted theme. If the theme would be invalid, the default Agnoster prompt is printed. ### 5. Profit 🎉🎉🎉 [nerdfonts]: https://www.nerdfonts.com/ [meslo]: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/Meslo.zip [powershell]: /docs/powershell [themes]: https://github.com/JanDeDobbeleer/oh-my-posh3/tree/main/themes