dsa-ou / m269-installer

Software installation script and instructions for M269
https://dsa-ou.github.io/m269-installer/
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

macOS: sometimes `~/.bash_profile` is sourced instead of `~/.bashrc` on terminal startup #37

Closed densnow closed 4 months ago

densnow commented 9 months ago

There have been two reported instances of macOS not sourcing ~/.bashrc on terminal start up. One of these was resolved by appending

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

to ~/.bash_profile.

This document is often posted in response to queries dealing with this topic. It details which startup files are used and the order they will be read by the shell including bash.

There might be an option inside of macOS to change the type of shell that is opened from "login shell" to "non-login shell", and hence source the ~/.bashrc by default. But this could have more implications to the system than checking for and appending the above code to the appropriate file.

densnow commented 4 months ago

Instead of modifying and overcomplicating the script for this potentially rare error, maybe it could be mentioned briefly at the end of the installation instructions.

The students who encountered this problem had run the script with no obvious errors or warnings being shown, but when they tried to use the aliases m269-23j and nb nothing happened. A quick fix is to enter the following command:

echo 'if [ -f ~/.bashrc ]; then source ~/.bashrc; fi' >> ~/.bash_profile
mwermelinger commented 4 months ago

I agree it's best to add to installation instructions than changing the script. Could you open a PR with that?Thanks.