4 if ! (uname -a | grep -i "darwin" > /dev/null); then
5 echo "No fish installer for Linux yet. Try this instead:"
6 echo " sudo apt install -y fish"
14 # Every package should define these 6 variables
17 pkg_dst_cmd="$HOME/.local/bin/fish"
18 pkg_dst="$pkg_dst_cmd"
20 pkg_src_cmd="$HOME/.local/opt/fish-v$WEBI_VERSION/bin/fish"
21 pkg_src_dir="$HOME/.local/opt/fish-v$WEBI_VERSION"
22 pkg_src="$pkg_src_cmd"
24 # pkg_install must be defined by every package
26 function _macos_post_install() {
27 if ! [ -e "$HOME/.local/bin/fish" ]; then
32 echo "Trying to set fish as the default shell..."
34 # stop the caching of preferences
37 # Set default Terminal.app shell to fish
38 defaults write com.apple.Terminal "Shell" -string "$HOME/.local/bin/fish"
39 echo "To set 'fish' as the default Terminal.app shell:"
40 echo " Terminal > Preferences > General > Shells open with:"
41 echo " $HOME/.local/bin/fish"
44 # Set default iTerm2 shell to fish
45 if [ -e "$HOME/Library/Preferences/com.googlecode.iterm2.plist" ]; then
46 /usr/libexec/PlistBuddy \
47 -c "SET ':New Bookmarks:0:Custom Command' 'Custom Shell'" \
48 $HOME/Library/Preferences/com.googlecode.iterm2.plist
49 /usr/libexec/PlistBuddy \
50 -c "SET ':New Bookmarks:0:Command' $HOME/.local/bin/fish" \
51 $HOME/Library/Preferences/com.googlecode.iterm2.plist
52 echo "To set 'fish' as the default iTerm2 shell:"
53 echo " iTerm2 > Preferences > Profiles > General > Command >"
54 echo " Custom Shell: $HOME/.local/bin/fish"
61 # always try to reset the default shells
64 function pkg_install() {
65 mv fish.app/Contents/Resources/base/usr/local "$HOME/.local/opt/fish-v${WEBI_VERSION}"
69 function pkg_post_install() {
70 # don't skip what webi would do automatically
73 # try again to update default shells, now that all files should exist
77 # pkg_get_current_version is recommended, but (soon) not required
78 function pkg_get_current_version() {
79 # 'fish --version' has output in this format:
81 # This trims it down to just the version number:
83 echo $(fish --version 2> /dev/null | head -n 1 | cut -d ' ' -f 3)