Install Fish Shell on Mac OS X and Ubuntu
Last updated: September 24, 2015 The Fish shell goes where few command-line shells have gone before, shedding its forebearers’ POSIX baggage in favor of simplicity, consistency, and ease-of-use. Much like the Mac creators thought computers should be made to understand how humans work (and not the other way around), Fish observes your past behavior and suggests commands that it thinks you might be trying to execute. Sometimes, those suggestions are so spot-on that it can be downright spooky. Reactions of “How did Fish know that’s what I wanted to do?” are not uncommon.In this article, we’re going to show how to install the Fish shell on Mac OS X and Ubuntu, followed by some basic setup steps. Subsequent posts will cover more advanced configuration.
So can a command-line shell be Mac-like? Let’s find out.
What is Fish and why would someone use it instead of another shell?
Fish has a number of advantages over other shells:- Fish suggests commands as you type based on history and completions, just like a web browser’s search bar
- Fish generates completions automatically by parsing your installed man pages
- Fish has a more intuitive syntax
- Fish has less historical baggage and technical debt
- Can a command-line shell be Mac-like?
- Fish: the friendly interactive shell — as described in 2005 by the original author
Installing Fish on Mac OS X 10.10 Yosemite
There are several ways to install Fish on Mac OS X:- traditional
.pkg
installer - standalone Mac application
- Homebrew
- manual compilation
That said, if you already use Homebrew (which I recommend) and have configured your environment as noted in the Mac OS X Setup Guide, then you can install Fish as you would any other package:
brew install fish
brew install --HEAD fish
/etc/shells
, which will require an administrative password:echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish
Install latest Fish on Mac OS X from source
If you want to use the latest bleeding-edge version of Fish and already have Xcode installed, use the following steps to install from source:git clone https://github.com/fish-shell/fish-shell ~/src/fish
cd ~/src/fish
xcodebuild install
ditto /tmp/fish.dst /
/etc/shells
, which will require an administrative password:echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish
Installing Fish on Ubuntu
On Ubuntu, the easiest way to keep up-to-date is via the offical PPA. If you prefer to install via.deb
package, or if you want to install the bleeding-edge version of Fish from source, those instructions are further below.Install Fish via PPA
The following steps will add the Fish 2.x PPA repository and install Fish:sudo apt-add-repository ppa:fish-shell/release-2
sudo apt-get update
sudo apt-get install fish
chsh -s /usr/bin/fish
Install Fish on Ubuntu via .deb
The following steps are for the 64-bit version of Ubuntu 14.04 LTS (“Trusty”). If you are using a different version of Ubuntu, you’ll need to retrieve an appropriate.deb
package from LaunchPad.First retrieve and then install the
.deb
package:wget https://launchpad.net/~fish-shell/+archive/ubuntu/release-2/+files/fish_2.2.0-1%7Etrusty_amd64.deb
sudo dpkg -i fish_2.2.0-1~trusty_amd64.deb
chsh -s /usr/bin/fish
Install bleeding-edge Fish via PPA
If you prefer, you can keep up-to-date with the bleeding-edge version of Fish via the nightly build PPA. To do so, add the nightly PPA and install Fish:sudo add-apt-repository ppa:fish-shell/nightly-master
sudo apt-get update
sudo apt-get install fish
chsh -s /usr/bin/fish
Install Fish on Ubuntu from source
Install dependencies:sudo aptitude install build-essential git autoconf libncurses5-dev libncursesw5-dev gettext
mkdir -p ~/src
git clone https://github.com/fish-shell/fish-shell ~/src/fish
cd ~/src/fish
autoconf
./configure --without-xsel
make
sudo make install
/etc/shells
:echo "/usr/local/bin/fish" | sudo tee -a /etc/shells
chsh -s /usr/local/bin/fish
Basic configuration
The Fish shell should now be installed, but a bit more configuration will prove helpful later.Create the Fish config directory:
mkdir -p ~/.config/fish
vim ~/.config/fish/config.fish
/usr/local/bin
to the PATH
environment variable:set -g -x PATH /usr/local/bin $PATH
help
, followed by the return key, to load user documentation in your default browser.You can also see your current configuration in your default browser by first entering this command:
fish_config
Fish can parse your installed man pages and automatically generate completion files for your command-line tools. You should periodically run the following command to update those completions, which are stored in
~/.config/fish/completions
by default:fish_update_completions
echo "set -g -x fish_greeting ''" >> ~/.config/fish/config.fish
''
marks.Getting back to Bash
If you want to temporarily switch to the Bash shell for a single session, run:bash
exit
to return to your Fish shell.If you decide Fish isn’t for you and want to permanently revert your default shell back to Bash:
chsh -s /bin/bash
Taking it to the next level
With Fish as your default shell, you may find that customizations you’ve made to your Bash environment are not present in Fish. The good news is that it’s easy to re-create those customizations — and create new enhancements — via Tacklebox, which allows you to easily use community-curated modules, plugins, and themes so you don’t have to create them yourself.I look forward to continuing the conversation on Twitter.
Comments
Post a Comment