Fish Shell Setup OS X
Terminal Setup for OS X with Fish Shell, Fisher, Powerline Fonts and iTerm2.
Quick Install
Can't wait to run the fish shell? You can run the install.sh to install the Fish Shell, Fisher, Powerline Fonts and iTerm2.
curl https://raw.githubusercontent.com/ellerbrock/fish-shell-setup-osx/master/install.sh | bash
iTerm2
- Download and Install iTerm2 - a better Terminal for OS X.
- iTerm2 Color Schemas - Color Themes for 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 [email protected]"
alias updatedb "sudo /usr/libexec/locate.updatedb"
alias myrsync "rsync -aihvP"
Fisher (A package manager for the fish shell)
Installation
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish
fisher
update allfisher add jethrokuan/z
autocompletion for most used directoriesfisher add edc/bass
for better bash compatibilityfisher add Markcial/cprintf
printf with coloursbrew install fzf; fisher add jethrokuan/fzf
fuzzing finderbrew install grc; fisher add fisherman/grc
colourizer for terminal apps
See the documentation for details.
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
Tips & 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:
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.
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:
- http://fishshell.com/docs/2.2/commands.html#set
- http://fishshell.com/docs/current/tutorial.html#tut_exports
Fun Stuff
Other useful Resources
- Awesome fish - A curated list of awesome tools, prompts and other cool nuggets for the amazing fish-shell.
- Fish Shell Cookbook - Tips and recipes for fish, from shell to plate.
- Awesome OS X Command Line - Use your OS X terminal shell to do awesome things.
Contact / Social Media
Get the latest News about Web Development, Open Source, Tooling, Server & Security
Development by
Developer / Author: Maik Ellerbrock Company: Frapsoft
License
This work by Maik Ellerbrock is licensed under a Creative Commons Attribution 4.0 International License.