This repository contains scripts to help you set up Fish shell with Oh My Posh and synchronize your bash PATH to fish PATH on Linux and macOS, as well as Oh My Posh for PowerShell on Windows.
The install-fish-ohmyposh.sh script automatically:
- Detects your platform (Linux/macOS) and adjusts behavior accordingly
- For Linux: Installs Fish shell using your system's package manager (supports apt, dnf, pamac, pacman, zypper)
- For macOS: Checks for and installs Homebrew if not present, then installs Fish shell using Homebrew
- Sets Fish as your default shell
- Installs Oh My Posh
- Downloads and installs Nerd Fonts (FiraCode)
- Downloads Oh My Posh themes
- Configures Oh My Posh in your Fish shell with the kushal theme
The sync-bash-path-to-fish-path.sh script:
- Synchronizes your bash PATH environment variable to your fish configuration, including paths from NVM, SDKMAN, and other tools sourced from bash initialization files
- Sources bash configuration files (.bashrc, .bash_profile, .profile) to capture environment changes made by tools like NVM and SDKMAN
- Preserves existing fish configuration while adding PATH entries
- Creates backups of your existing fish configuration
The install-ohmyposh-windows.ps1 PowerShell script:
- Installs Oh My Posh using Chocolatey or Winget (with fallback to manual installation)
- Downloads and installs Nerd Fonts (FiraCode)
- Downloads Oh My Posh themes
- Configures Oh My Posh in your PowerShell profile with the kushal theme
The validate-fonts.ps1 PowerShell script:
- Checks if Nerd Fonts are properly installed and available to terminals
- Helps troubleshoot font availability issues
- Provides instructions for setting up fonts in different terminals
The fix-ohmyposh-init.ps1 PowerShell script:
- Fixes the Get-PSReadLineKeyHandler error that appears on PowerShell startup
- Updates the PowerShell profile with a more compatible initialization
- Ensures Oh My Posh works properly with different PSReadLine versions
The update-profile-manually.ps1 PowerShell script:
- Provides an alternative way to manually update your PowerShell profile
- Fixes PSReadLine errors by replacing problematic initialization code
- Offers more control over the Oh My Posh initialization process
The scripts install the kushal theme by default, but Oh My Posh offers many other themes. You can browse all available themes at Oh My Posh Themes. After installation, you can change to a different theme by modifying your shell configuration file with your preferred theme from the gallery.
To install Fish shell with Oh My Posh on Linux/macOS, run this command directly in your terminal:
curl -fsSL https://raw.githubusercontent.com/Isidro-Zertucha/Fish-OhMyPosh-Automated-Installation-and-Copy-PATH-From-Bash-Scripts/main/scripts/install-fish-ohmyposh.sh | bashTo synchronize your bash PATH to fish PATH on Linux/macOS, run this command in your terminal after installing Fish and Oh My Posh (note: this is automatically done at the end of the installation script if you respond "y"):
curl -fsSL https://raw.githubusercontent.com/Isidro-Zertucha/Fish-OhMyPosh-Automated-Installation-and-Copy-PATH-From-Bash-Scripts/main/scripts/sync-bash-path-to-fish-path.sh | bashTo install Oh My Posh on Windows with PowerShell, run this command directly in an Administrator PowerShell terminal (for best results run as Administrator):
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-Expression "& {$(Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/Isidro-Zertucha/Fish-OhMyPosh-Automated-Installation-and-Copy-PATH-From-Bash-Scripts/main/scripts/install-ohmyposh-windows.ps1')}"The Linux/macOS script requires sudo access to install Fish and Oh My Posh to system directories. The Windows PowerShell script may require Administrator privileges for optimal installation. Always review scripts before running them directly from the internet, especially ones that require elevated privileges.
sudoaccess- Linux system with one of the supported package managers (apt, dnf, pamac, pacman, zypper), or macOS 10.12+ with Homebrew (will be installed automatically if not present)
curlorwgetfor downloading dependencies
- Windows 10 or 11
- PowerShell 5.1 or later
- Internet connection for downloading dependencies
- Administrator privileges recommended for optimal installation
If you've installed the fonts but they're not showing up in your terminal:
- Run as Administrator: Make sure you ran the installation script as an Administrator for full font system integration.
- Validate Font Installation: Run the validation script to check if fonts are properly installed:
# Navigate to the scripts directory and run the validation script .\validate-fonts.ps1
- Restart Your Terminal: Close and reopen your terminal application completely.
- Check Terminal Settings: Make sure your terminal is configured to use a Nerd Font (e.g., "FiraCode NF").
- System Restart: If fonts still don't appear, restart your computer to ensure Windows properly registers the fonts.
- Font not appearing in terminal: This is usually because the font wasn't properly registered in the system or the terminal isn't configured to use it.
- Prompt symbols not showing correctly: This typically means your terminal is not using a Nerd Font that supports the symbols needed by Oh My Posh.
- Oh My Posh not initializing: Check your PowerShell profile (
$PROFILE) to verify the initialization line was added correctly. - Get-PSReadLineKeyHandler errors on startup: If you see red error messages about positional parameters with Spacebar, Enter, or Ctrl+c, run either the
fix-ohmyposh-init.ps1orupdate-profile-manually.ps1script to update the initialization with a PSReadLine-compatible version. - Zip archive extraction errors: If you see "End of Central Directory record could not be found" errors, this is typically due to incomplete downloads. The updated script now includes verification and retry logic to handle this. If problems persist, you may need to download the zip files manually.
This project is licensed under the terms in the LICENSE file.