8

I'm trying to use fish shell as my default shell on OSX. I have installed fish shell using brew and when I wanted to add it to /etc/shells I got this error:

tee: /etc/shells: No such file or directory

Here's the command line I used:

echo "usr/local/bin/fish" | sudo tee -a /etc/shells

Source: https://hackercodex.com/guide/install-fish-shell-mac-ubuntu/

Is there something wrong with my $PATH?

2
  • slm's answer works. Even if you successfully add it to /etc/shells which you could just do with a text editor, you'd still have to run the chsh command to make it your default shell. Commented Jul 11, 2018 at 3:26
  • 1
    Can it be you mistyped the path? Yours: "usr/local/blabla" --> My guess: "/usr/local/blabla". There's the root path missing. Commented Dec 20, 2018 at 8:14

1 Answer 1

13

You're doing it wrong. You should be using the chsh command to change your user's shell.

$ chsh -s /usr/local/bin/fish

OSX

On OSX you apparently have to add this to the /etc/shells file as described in this issue titled: OS X refuses to setting fish as default shell(installed via Homebrew) #989.

To do this you need to run this command to add it to /etc/shells:

$ echo "/usr/local/bin/fish" | sudo tee -a /etc/shells

After that this file will look like this:

$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/bash
/usr/local/bin/fish

With the above complete, try the chsh -s ... command again and it should work.

Why?

This issue seems to arise with how fish was installed. If you use brew install fish then it's likely that fish was properly added to /etc/shells. If you install fish through some other means, then it's likely that it did not get added as an entry to the /etc/shells file.

Secondary issue

In some cases the permissions on /etc itself may be the issue.

$ ll /etc
lrwxr-xr-x@ 1 root  wheel    11B Jan 26  2016 /etc -> private/etc

$ ll -d private/etc/
drwxr-xr-x  96 root  wheel   3.2K Jul 12 18:53 private/etc/

These permissions are acceptable, if they're not, you can modify them like this:

$ sudo mount -uw / 
$ sudo chmod a+x private/etc

With the above changes, chsh -s ... should now work.

References

8
  • 1
    I still don't have fish shell added to my shells file. When I enter the command-line $ chsh: /usr/local/bin/fish I get this: chsh: /usr/local/bin/fish: non-standard shell I have read from the source I mentioned above that I should add fish shell to /etc/shells before I use this command-line Commented Jul 12, 2018 at 0:14
  • @LokmanBoukhoulda - I see your issue now, see updates to the A'er. Commented Jul 12, 2018 at 0:55
  • I got this error $ cat: /etc/shells: No such file or directory When I entered the following command-line: $ ls -l /etc/shells I got this message: lrwxr-xr-x 1 user admin 29 9 Jun 00:20 /etc/shells -> ../Cellar/fish/2.7.1/bin/fish I'm confused, does the file /etc/shells exist? Commented Jul 12, 2018 at 3:56
  • @LokmanBoukhoulda - So it looks like fish just co-opted the /etc/shells file and made a link to some other file (link is made using the ln -s command. It looks like you had fish installed via brew based on that ../Cellar/ directory. Commented Jul 12, 2018 at 3:59
  • @LokmanBoukhoulda - I'd delete that link and simply re-make that file using the one I showed. sudo unlink /etc/shells. Commented Jul 12, 2018 at 4:01

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.