Fish Shell

Fish Shell Setup OS X Open Source Love Gitter Chat

Terminal Setup for OS X with Fish Shell, Fisherman, Powerline Fonts and iTerm2.

Fish Shell

Quick Install

Can't wait to run the fish shell?
You can run the install.sh to install the Fish Shell, Fisherman, Powerline Fonts and iTerm2.

curl https://github.com/ellerbrock/tutorial-fish-shell-setup-osx/blob/master/install.sh | bash

iTerm2

Powerline Fonts

brew install fontconfig
cp /usr/local/etc/fonts/fonts.conf.bak /usr/local/etc/fonts/fonts.conf

git clone https://github.com/powerline/fonts.git
./fonts/install.sh

Fish Shell

Fish Shell Installation (latest):
brew install fish --HEAD

add the shell to the system know shells: echo /usr/local/bin/fish | sudo tee -a /etc/shells

make fish your default shell:
chsh -s /usr/local/bin/fish

The Fish Shell configuration folder is located under: ~/.config/fish/

The main configuration file is: ~/.config/fish/config.fish, i source here 2 files.

source ~/.fish_aliases
source ~/.fish_variables

create a file ~/.fish_variables to source your variables:

# Setup your Github Token
set --export HOMEBREW_GITHUB_API_TOKEN "01010101010101010101010101"

# add /usr/local/sbin to your PATH Variable
set --export PATH /usr/local/sbin $PATH

create a file ~/.fish_aliases to source your aliases:

alias l "ls -alF"
alias .. "cd .."
alias sshserver "ssh user@server.dev"
alias updatedb "sudo /usr/libexec/locate.updatedb"
alias myrsync "rsync -aihvP"

Fisherman (Fish Shell Extension / Plugins)

Homepage: fisherman.sh

Installation:
curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisherman

Themes

A list with screenshots of available themes.

I like the Budspencer Theme, so lets install it.

Make sure sure you have install Fish in the latest Version (brew install fish --HEAD) to run the budspencer theme.

brew install --with-default-names gnu-sed install dependencies

fisher omf/theme-budspencer install the theme budspencer

Theme Setup:

set -U budspencer_nogreeting
set -U fish_key_bindings fish_vi_key_bindings

Tipps & Tricks

fish_update_completions run this once in a while to make the fish prompt aware of available commands and parameters

Update Script

If you run this more often makes then you can put an alias to this file in your `~/.fish_aliases we talked about above.

#!/usr/bin/env fish

echo 'start updating ...'

echo 'updating homebrew'
brew update
brew upgrade
brew cleanup

echo 'updating fish shell'
fisher up
fish_update_completions

echo 'updating npm'
npm update -g

echo 'checking Apple Updates'
/usr/sbin/softwareupdate -ia

exit 0

iTerm default screen

I use the terminal a lot and one windows is just not enought for me.
You can setup your default window in iTerm2 like you want, mine looks like this:

Fish Shell Screenshot

One big windows on the left for coding or more detailed stuff and two split windows on the right to quickly fire some commands.

To Setup your window like you prefare just right click in the iTerms windows and say "Split Pane Vertically or Horizontally" to your needs.
When you like it go to "Window -> Save Window Arrangment". For the last step go to "Preferences -> Arrangment" and set it to default.
Next time you open iTerms it starts with your prefared awesome window setup.

Fish Shell Screenshot

Aliases and Exports

Aliases

alias rmi "rm -i"

# This is equivalent to entering the following function:

function rmi
    rm -i $argv
end

funcsave

http://fishshell.com/docs/current/commands.html#alias

Exports

set -xU APIKEY "SEC112233"

x == export
U == universal - meaning that you can access the Variable from other sessions or terminals as well.

set --export PATH /usr/local/sbin $PATH another way to export

More details can be found here:

Fun Stuff

Other useful Resources

Contact / Social Media

Get the latest News about Web Development, Open Source, Tooling, Server & Security

Twitter Facebook Google+ Gitter Github

Development by

Developer / Author: Maik Ellerbrock
Company: Frapsoft

License

Creative Commons License

This work by Maik Ellerbrock is licensed under a Creative Commons Attribution 4.0 International License.