Bash CLI is not behaving after upgrading Mac to Catalina - ruby

I was previously on Mojave but was forced to update because of XCode.
When it finished installing, I had to change the default Login Shell, because Catalina now uses Z Shell.
After I did that, my CLI still looks and acts very different:
BEFORE:
This is what it currently looks like:
AFTER:
I googled' line 33: __rvm_read_lines _hooks_list <(' and was advised to run: source ~/.bashrc. Nothing changed, until I ran source ./bash_profile and it started to somewhat feel better, but it still not performing commands properly. There is always some error.
Lastly, why do I have to run source ~/.bash_profile every time? I just want this to be back to normal.

After the upgrade, my CLI actually gave me this message:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
Foolishly, I ran that command, hoping it would go away.
It was fixed by switching back to chsh -s /bin/bash not sh.

Related

How to completely remove zsh (oh-my-zsh) from Mac M1 (MacOS Monterey)

I have tried to run:
uninstall_oh_my_zsh
but i get a message stating that: -bash: uninstall_oh_my_zsh: command not found
Other commands i have tried are:
chmod +x ~/.oh-my-zsh/tools/uninstall.sh
I get a response stating that: No such file or directory
sh ~/.oh-my-zsh/tools/uninstall.sh
Ran:
chsh -s /bin/bash
To change default terminal from /bin/zsh to /bin/bash
I also tried:
rm -rf ~/.oh-my-zsh
rm ~/.zshrc
cp ~/.zshrc.pre-oh-my-zsh ~/.zshrc
source ~/.zshrc
None of them have worked thus far, when i open my terminal. I get a message stating that:
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh
You don't have Oh My Zsh (a set of configuration files for zsh and a way to manage them) installed in the first place.
The warning is coming from /bin/bash itself; it's hard-coded into the executable supplied by macOS.
$ strings /bin/bash | grep "default interactive shell"
The default interactive shell is now zsh.
Though they don't say so, I suspect the warning is there because they plan to remove bash from future versions of macOS entirely. They stopped providing newer versions of bash years ago.
Your default shell is already /bin/bash; the warning is recommending that you switch to /bin/zsh.
You can continue to use bash, though I recommend installing a newer version (3.2 is old) using something like Homebrew, then changing your login shell to the new version.
However, unless you are really committed to using bash, I suggest given zsh a try.

-bash: ghci: command not found (Haskell interactive shell, Haskell installation )

edit : I ended up upgrading to macOS Catalina yesterday and replacing bash with zsh. One thing that should be noted is that the stackcommand worked previously, but despite all the tinkering not ghci
After deleting all the files that had anything to do with Haskell, I retried running curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
This second time there was an error with the command line tools so I had to install them manually with xcode-select --install. After rerunning the curl, I added the path to the environmental file to my zsh profile manually with :
. "$HOME/.ghcup/env"\
echo '. $HOME/.ghcup/env' >> "$HOME/.zshrc"
Here is the content of the env file :export PATH="$HOME/.cabal/bin:/Users/agnel/.ghcup/bin:$PATH"
Now everything seems to be working (I never reinstalled stack, but I think I might leave that to the side while I learn the basics of the language).
I installed the Haskell Platform yesterday but am having a hard time getting it to work correctly.
The firsts steps I did are:
curl -sSL https://get.haskellstack.org/ | sh
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
On step 1. the instructions said to append /Users/.../.local/bin the PATH variable (which I did in /etc/paths. On step 2, the script was supposed to pop up a dialog box (and didn't) when installing the necessary command line tools. It also said to rerun the script once complete (which I did). The script also said I should adjust my PATH variable, and source /Users/.../.ghcup/env in my shell configuration. It asked to this automatically but failed having not found the ~/.bashrc File. (I read that on Mac in contrary to linux, only .bash_profile is loaded upon opening of a terminal window so I adjusted the path variable there manually. I've spent forever messing around with the path variables and every time I try and run "$ ghci" I get the same -bash: ghci: command not found error message. If anyone has a solution to this problem I would be very grateful for an answer. If not, could someone with a working distribution of Haskell on their computer show me what their path variables look like?
Thanks!
A simple solution would just be to restart your terminal and you are good to go.
After installing the Haskell platform for the first time on a new mac with Catalina, I also got
~> ghci
zsh: command not found: ghci
What worked in my case was to use, instead of the plain ghci,
stack ghci
To get back the familiar behaviour, I created in my homedirectory a file named .zshrc containing
alias ghci='stack ghci'
If you open a new terminal, this file will automatically be executed.
I'd be interested to know if there is another solution.
Check if the ghcup command is working or not.
If not, make sure the .zshrc file has command for execution of ghcup. It should look something like this -
[ -f "/Users/myusername/.ghcup/env" ] && source "/Users/myusername/.ghcup/env" # ghcup-env
If the file exists, simply restarting terminal will work.
If it is still not working, set GHC as default using ghcup - follow this

Terminal modified permanently by vscode

I installed vscode today and followed the steps on tutorials on youtube to set up. My terminal started to act weird after I called python through the terminal and tried to use pip install command but failed. I uninstalled the app, deleted all the relevant files, and tried to reopen the terminal. The terminal still has the same warnings.
I have contacted Apple Tech support and they say my terminal got modified by the app. They asked me to contact the app developer.
I don't know what I did to get where I am now. I would appreciate any help that can bring my terminal back to normal.
Below are the warnings even after I uninstalled the app:
Last login: Wed Jun 10 23:02:45 on ttys000
You have mail.
-bash: Saving: command not found
-bash: ...copying: command not found
-bash: ...saving: command not found
-bash: ...completed.: command not found
-bash: Deleting: command not found
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
ZhouChristinas-MacBook-Pro:~ zhouchristina$
Check your shell's startup script, it looks like you have text there that aren't shell commands. I don't know whether you have bash or zsh as your shell, but check all of these files just to be sure:
~/.bashrc
~/.bash_aliases
~/.bash_profile
~/.bash_login
~/.zshrc
~/.zshenv
~/.zprofile
~/.zlogin
~/.profile
Also look into any files that are sourced by these files.

macos catalina bash shell not saving history

Last night I went into my bash shell in terminal and entered a few commands. Then today I go in but theyre not saved in the history (arrow up). However the really old commands I used about 5 or more months ago are there, so the history is not empty.
Why is my history no longer activated and how do I activate it?
macOS Catalina uses zsh as your shell, so your shell settings go to ~/.zshrc
Edit your settings:
nano ~/.zshrc
Add these lines to your ~/.zshrc file:
HISTSIZE=100000
HISTFILESIZE=999999
SAVEHIST=$HISTSIZE
The historycommand in zshalso shows only 16 most recent lines from the history file unless you give it the start line as a parameter:
history 0
This will show you the whole history.
You can make an alias for this, so that the history command without the parameter will show the complete history as well:
Add this line to your ~/.zshrc file:
alias history="history 0"
I switched from zsh to bash in OSX Catalina but the shell history wasn't saving. I had success fixing that by creating the ~/.bash_profile file and putting this inside:
export SHELL_SESSION_HISTORY=0
Got the idea from this older thread: https://apple.stackexchange.com/questions/218731/why-bash-history-on-my-mac-wont-save
Since macOS Catalina Apple's default shell is no longer bash, but zsh.
Therefore your sources will no longer come from your .bashrc or .bash_profile.
If you want to bash to be your default shell follow this steps:
System Preferences > Users and groups > right click on your user and select advance options. > On the Login Shell drop down menu select your prefered shell.
Hope this helps!
I solve the problem for myself as follow:
Check which shell is running: echo $SHELL
It should return /bin/bash. Otherwise my solution not applied.
Backup .bash_profile with: mv .bash_profile .bash_profile.bak
Close your shell with CMD + w.
Reopen Terminal to check if bash history works, by typing some commands, then using arrow up to check
If terminal history seems to work again. Then the cause of the error lays down in the .bash_profile. If you want to keep your .bash_profile, you should comment out each of the command in there, to find out which commands cause the problem with the Terminal history.
In my case, the cause was commands of my working place related to cloud tooling.
I hope to help someone out!
Best

Bash aliases not recognized after uninstalling oh my zsh

After I attempted to uninstall oh-my-zsh, I am getting the error
/Users/Thomas/.zshrc:source:56: no such file or directory: /Users/Thomas/.oh-my-zsh/oh-my-zsh.sh
This issue indicates that the original shell needs to be reverted back to, however the provided command
chsh -s /bin/bash
is not working. I've restarted my iTerm as well. And my aliases still don't work, as well as exported variables such as $JAVA_HOME return empty, even though they are properly set using my former .bash_profile. Also rather than ending with a ~ my terminal prompt ends with a %
Thomas%
How can I revert?
One detail, when I attempted the uninstall via uninstall_oh_my_zsh I mistyped my password. Rather than prompting me again, it looked as though it went ahead and completed the uninstall, but maybe some component of it didn't complete properly.
Make sure you have Brew installed.
Enter brew remove zsh into the terminal then reset your terminal, it should reconfigure back to your original shell.
For this kind of error, you need to check if you set the default bash to zsh in .bashrc file. So, if there is any, just comment them out.
Example for mine.
#Launch Zsh
if [ -t 1 ]; then
exec zsh
fi
So, you just need to comment that out.
#Launch Zsh
#if [ -t 1 ]; then
#exec zsh
#fi

Resources