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