MacPorts bash on Big Sur as default shell

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

MacPorts bash on Big Sur as default shell

MacPorts - Users mailing list
I'm not able to get MacPorts bash working in Terminal as the default shell.

This is fresh install of Big Sur 11.2 on a new machine, fresh install of MacPorts. Only bash and bash-autocomplete are installed

Setting the shell in either the Terminal preferences or for my user to /opt/local/bin/bash always leaves me in /bin/bash 

The "best" workaround so far is to start in zsh which has the PATH set correctly and exec bash from there.

My old machine where has been through many upgrades including Big Sur "just works", 

I've run out of ideas, I'd appreciate pointers.
Reply | Threaded
Open this post in threaded view
|

Re: MacPorts bash on Big Sur as default shell

Peter West-2
I set my default shell to /bin/bash.

I kept the contents of my .profile as they were, making sure to export all of the variables I wanted, and bracketed them with tests like so:

eval profile_read=\$${USER}_profile_read
if [ -n "$profile_read" ]
then {
    echo `date` "~/.profile already read" >>/tmp/$USER.init_scripts
    return
}
fi

…and…

eval export ${USER}_profile_read=true
echo `date` "~/.profile sourced" >>/tmp/$USER.init_scripts

if [ -x "/opt/local/bin/bash" ]; then
        [ "$BASH" != "/opt/local/bin/bash" ] && exec /opt/local/bin/bash
fi


Peter



Peter West
[hidden email]
“Martha, Martha, you are anxious and troubled about many things, but one thing is necessary.”


> On 11 Feb 2021, at 7:35 am, Mike Summers via macports-users <[hidden email]> wrote:
>
> I'm not able to get MacPorts bash working in Terminal as the default shell.
>
> This is fresh install of Big Sur 11.2 on a new machine, fresh install of MacPorts. Only bash and bash-autocomplete are installed
>
> Setting the shell in either the Terminal preferences or for my user to /opt/local/bin/bash always leaves me in /bin/bash
>
> The "best" workaround so far is to start in zsh which has the PATH set correctly and exec bash from there.
>
> My old machine where has been through many upgrades including Big Sur "just works",
>
> I've run out of ideas, I'd appreciate pointers.

Reply | Threaded
Open this post in threaded view
|

Re: MacPorts bash on Big Sur as default shell

Rainer Müller-4
In reply to this post by MacPorts - Users mailing list
On 10/02/2021 22.35, Mike Summers via macports-users wrote:
> I'm not able to get MacPorts bash working in Terminal as the default shell.
>
> This is fresh install of Big Sur 11.2 on a new machine, fresh install of
> MacPorts. Only bash and bash-autocomplete are installed
>
> Setting the shell in either the Terminal preferences or for my user to
> /opt/local/bin/bash always leaves me in /bin/bash

Make sure you use the correct command to lauch in the Terminal preferences.
See here for the details:

https://trac.macports.org/wiki/howto/bash-completion#Terminal.app

> The "best" workaround so far is to start in zsh which has the PATH set correctly
> and exec bash from there.

The MacPorts installer only added PATH to the login shell of your user account.
For zsh, you can find the addition the .zprofile file in your home directory.

If you want to use a different shell, you need to make sure to configure PATH
for that shell. For bash that means you need to configure it in your
.bash_profile accordingly.

https://guide.macports.org/chunked/installing.shell.html#installing.shell.postflight

> My old machine where has been through many upgrades including Big Sur "just works", 
>
> I've run out of ideas, I'd appreciate pointers.

Those older machines may already have the PATH settings in .bash_profile,
because you most probably installed MacPorts while bash was the login shell.

Rainer
Reply | Threaded
Open this post in threaded view
|

Re: MacPorts bash on Big Sur as default shell

MacPorts - Users mailing list
In reply to this post by Peter West-2
Thanks Peter, your note put me on the right track.

What I should have done was set my default shell (with chsh or Users & Groups) to /bin/bash before installing MacPorts bash. Then the PATH tweaks from the MacPorts bash installer fix-up the PATH and the MacPorts bash is always invoked.

--Mike

On Wed, Feb 10, 2021 at 9:10 PM Peter West <[hidden email]> wrote:
I set my default shell to /bin/bash.

I kept the contents of my .profile as they were, making sure to export all of the variables I wanted, and bracketed them with tests like so:

eval profile_read=\$${USER}_profile_read
if [ -n "$profile_read" ]
then {
    echo `date` "~/.profile already read" >>/tmp/$USER.init_scripts
    return
}
fi

…and…

eval export ${USER}_profile_read=true
echo `date` "~/.profile sourced" >>/tmp/$USER.init_scripts

if [ -x "/opt/local/bin/bash" ]; then
        [ "$BASH" != "/opt/local/bin/bash" ] && exec /opt/local/bin/bash
fi


Peter



Peter West
[hidden email]
“Martha, Martha, you are anxious and troubled about many things, but one thing is necessary.”


> On 11 Feb 2021, at 7:35 am, Mike Summers via macports-users <[hidden email]> wrote:
>
> I'm not able to get MacPorts bash working in Terminal as the default shell.
>
> This is fresh install of Big Sur 11.2 on a new machine, fresh install of MacPorts. Only bash and bash-autocomplete are installed
>
> Setting the shell in either the Terminal preferences or for my user to /opt/local/bin/bash always leaves me in /bin/bash
>
> The "best" workaround so far is to start in zsh which has the PATH set correctly and exec bash from there.
>
> My old machine where has been through many upgrades including Big Sur "just works",
>
> I've run out of ideas, I'd appreciate pointers.

Reply | Threaded
Open this post in threaded view
|

Re: MacPorts bash on Big Sur as default shell

MacPorts - Users mailing list
In reply to this post by Rainer Müller-4
Thanks Rainer, that was exactly the case.

On Thu, Feb 11, 2021 at 7:02 AM Rainer Müller <[hidden email]> wrote:
On 10/02/2021 22.35, Mike Summers via macports-users wrote:
> I'm not able to get MacPorts bash working in Terminal as the default shell.
>
> This is fresh install of Big Sur 11.2 on a new machine, fresh install of
> MacPorts. Only bash and bash-autocomplete are installed
>
> Setting the shell in either the Terminal preferences or for my user to
> /opt/local/bin/bash always leaves me in /bin/bash

Make sure you use the correct command to lauch in the Terminal preferences.
See here for the details:

https://trac.macports.org/wiki/howto/bash-completion#Terminal.app

> The "best" workaround so far is to start in zsh which has the PATH set correctly
> and exec bash from there.

The MacPorts installer only added PATH to the login shell of your user account.
For zsh, you can find the addition the .zprofile file in your home directory.

If you want to use a different shell, you need to make sure to configure PATH
for that shell. For bash that means you need to configure it in your
.bash_profile accordingly.

https://guide.macports.org/chunked/installing.shell.html#installing.shell.postflight

> My old machine where has been through many upgrades including Big Sur "just works", 
>
> I've run out of ideas, I'd appreciate pointers.

Those older machines may already have the PATH settings in .bash_profile,
because you most probably installed MacPorts while bash was the login shell.

Rainer
Reply | Threaded
Open this post in threaded view
|

Re: MacPorts bash on Big Sur as default shell

Bjarne D Mathiesen
In reply to this post by MacPorts - Users mailing list
I'd recommend the following which is part of my standard config:

cd /private/etc
cp paths paths.d/999-macOS
mv paths paths.orig
echo "/opt/local/bin"      >  paths
echo "/opt/local/sbin"     >> paths
echo "/opt/local/bin/bash" >> shells
echo "/opt/local/bin/zsh"  >> shells

you can now do "chsh -s /opt/local/bin/bash [user]


--
Bjarne D Mathiesen
Korsør ; Danmark ; Europa
----------------------------------------------------------------------
denne besked er skrevet i et totalt M$-frit miljø
macOS 10.15.7 Cataina
2 x 3,46 GHz 6-Core Intel Xeon ; 112 GB 1333 MHz DDR3 ECC
ATI Radeon RX 590 8 GB
Reply | Threaded
Open this post in threaded view
|

Re: MacPorts bash on Big Sur as default shell

Richard L. Hamilton-3
I'd add that AS LONG AS you have a separate admin and user account, you can do anything you please to your user account; but best to leave settings for the admin account as close to system default as possible; that way you minimize the risk of locking yourself out in the event that an OS update doesn't play nice with what you've done to your own account. Also, if you have root enabled, don't give it non-default settings, just to be safe.

In event of a major OS upgrade, dependencies on MacPorts may break until it is re-installed for the new OS version...which may not be immediately possible, esp. for early updaters to the new OS version.

> On Feb 11, 2021, at 15:32, Bjarne D Mathiesen <[hidden email]> wrote:
>
> I'd recommend the following which is part of my standard config:
>
> cd /private/etc
> cp paths paths.d/999-macOS
> mv paths paths.orig
> echo "/opt/local/bin"      >  paths
> echo "/opt/local/sbin"     >> paths
> echo "/opt/local/bin/bash" >> shells
> echo "/opt/local/bin/zsh"  >> shells
>
> you can now do "chsh -s /opt/local/bin/bash [user]
>
>
> --
> Bjarne D Mathiesen
> Korsør ; Danmark ; Europa
> ----------------------------------------------------------------------
> denne besked er skrevet i et totalt M$-frit miljø
> macOS 10.15.7 Cataina
> 2 x 3,46 GHz 6-Core Intel Xeon ; 112 GB 1333 MHz DDR3 ECC
> ATI Radeon RX 590 8 GB
>


smime.p7s (3K) Download Attachment