2

I'm on macOS and I accidentally removed /usr/local/bin/fish while fish was being set as my shell.

Now when I try to start my terminal I get:

login: /usr/local/bin/fish: No such file or directory

What can I do to either set up bash or set up fish again as my shell?

3
  • 1
    Configure your terminal to use /bin/zsh rather than your login shell. Then start a new terminal and reinstall fish. Alternatively, if you have a TimeMachine backup just restore fish from that backup. If you don't have TimeMachine configured now would be a good time to do so. Commented Nov 25, 2021 at 23:19
  • I'm not a MAC user so I'm making assumptions it works like most other Unixes - are you able to edit /etc/passwd? If so you should be able to find the entry for your user in this shell and modify it to /bin/bash. Alternatively, if you can copy /bin/bash to /usr/local/bin/fish you should be able to log in with a bash shell and then reinstall /usr/local/bin/fish.
    – davidgo
    Commented Nov 26, 2021 at 4:52
  • @davidgo macOS doesn't really use /etc/password (except for a short period during bootup); it's basically a stub. The actual user data is in .plist files under /private/var/db/dslocal/nodes/Default/users/ (which you shouldn't try to access directly). Commented Nov 26, 2021 at 10:23

2 Answers 2

3

You can temporarily override your user shell setting in the Terminal application's preferences. Choose Terminal menu > Preferences, select the General tab, then set "Shells open with" to "Command (complete path)", and set the path to either /bin/zsh or /bin/bash (whichever you prefer).

Then use that shell to reinstall fish, and set "Shells open with" back to "Default login shell".

Alternately, if you want to more permanently switch to zsh or bash, open System Preferences > Users & Groups pane, click the padlock and authenticate, then Control-click on your user account (in the left sidebar) and choose Advanced Options from the contextual menu that appears. In the Advanced Options dialog, change the "Login shell" to /bin/zsh or /bin/bash or whatever you like. Do not change anything else here. You can mess your account up in fascinating ways by changing things in the Advanced Options if you don't know exactly what you're doing.

-1

Log in as root and run chsh -s /usr/bin/bash <userid>. Once that's done, you can reinstall fish and reset your shell. If bash is not there, then supply the correct path, or choose another shell.

2
  • Thank you. How do I login as root, and what is the <userid>? Commented Nov 25, 2021 at 22:44
  • Sorry, I never saw you're on a mac. I assume there is something similar to root. <userid> is your username. Commented Nov 25, 2021 at 22:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .