Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Monday June 10 2019, @01:25PM   Printer-friendly
from the fine-print dept.

Submitted via IRC for SoyCow4463

Why does macOS Catalina use Zsh instead of Bash? Licensing

Yesterday, at its WWDC developer conference, Apple unveiled the latest version of the MacOS operating system. Codenamed Catalina, it's a fairly significant update for the platform, not least because of the changes that have taken place under the hood. Take, for example, the default shell, which has been migrated from Bash to Zsh.

Bash has been the primary macOS shell since OS X 10.2 Jaguar. For almost sixteen years, MacOS developers have used it to write scripts and issue commands to the underlying operating system. It's deeply ingrained in how developers work. So, why the sudden change?

In a word: licensing.

[...] Newer versions of Bash are licensed under the GNU General Public License version 3 – or GPLv3 for short. This comes with several restrictions which could potentially have caused a few headaches for Apple further down the line.

Firstly, the GPLv3 include language that prohibits vendors from using GPL-licensed code on systems that prevent third parties from installing their own software. This controversial practice has a name: Tivoization, after the popular TiVo DVR boxes which are based on the Linux kernel, but only run software with an approved digital signature.

Secondly, the GPLv3 includes an explicit patent license. This can be hard to wrap your head around, but in a nutshell, it means that anyone who licenses code under the GPLv3 also explicitly grants a license to any of the associated patents. This isn't a comprehensive licensing deal; it only applies to the extent required to actually use the code.

[...] These two clauses are likely the reason why Apple's increasingly vary[sic] of GPL-licensed software, and is desperately trying to remove it from macOS. Between MacOS 10.5 Leopard and MacOS 10.12 Sierra, the number of GPL-licensed packages that came pre-installed decreased by an insane 66 percent – from 47 to just 16.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Informative) by Mike on Monday June 10 2019, @03:59PM (6 children)

    by Mike (823) on Monday June 10 2019, @03:59PM (#853732)

    "... it just prints the name of your PWD before the prompt (there might be a setting for disabling this on bash, I dunno; never realized how much it bothered me until I switched to zsh)."

    The bash prompt is adjustable. IIRC, originally it didn't default to showing the current path at all. But you can pick from a couple defaults or write code for what you want for the prompt to show (mine shows the pwd, but limits what's displayed to a max length). I haven't use zsh much, but I would be shocked if the prompt was not similarly adjustable.

    Starting Score:    1  point
    Moderation   +2  
       Informative=2, Total=2
    Extra 'Informative' Modifier   0  

    Total Score:   3  
  • (Score: 4, Informative) by NotSanguine on Monday June 10 2019, @04:41PM (3 children)

    The bash prompt is adjustable. IIRC

    Yes, you remember correctly. The prompt I prefer is defined as follows:

    # Define some colors first:
    red='\e[0;31m'
    RED='\e[1;31m'
    blue='\e[0;34m'
    BLUE='\e[1;34m'
    cyan='\e[0;36m'
    CYAN='\e[1;36m'
    green='\e[0;32m'
    GREEN='\e[1;32m'
    NC='\e[0m' # No Color
    yellow='\e[0;33m'
    magenta='\e[0;35m'
    YELLOW='\e[1;33m'
    MAGENTA='\e[1;35m'
    export PS1="[${YELLOW}\u@\H ${BLUE}\t$NC][${blue}\w$NC](${GREEN}\#$NC)\n\$ "

    The variable PS1 is where the rubber meets the road and I end up with:

    [user@host 12:31:56][~](8)
    $

    Where the [~] is PWD and (8) is current command number (cf. $SAVEHIST and $HISTSIZE)

    More details here [ss64.com].

    --
    No, no, you're not thinking; you're just being logical. --Niels Bohr
    • (Score: 0) by Anonymous Coward on Monday June 10 2019, @07:22PM (1 child)

      by Anonymous Coward on Monday June 10 2019, @07:22PM (#853820)

      Colors are nice addition if done right. Around here, one thing we do is change the color of the user and "host" portions of the prompt depending on the logged in user and the hostname and IP address. This prevents some of losing where you are in tmux/screen and where you are logged in. Going to run a destructive test after changing a file in production? better double check that the host isn't red anymore and you are the turquoise test user.

      • (Score: 0) by Anonymous Coward on Monday June 10 2019, @09:40PM

        by Anonymous Coward on Monday June 10 2019, @09:40PM (#853901)

        Colors are nice addition if done right. Around here, one thing we do is change the color of the user and "host" portions of the prompt depending on the logged in user and the hostname and IP address. This prevents some of losing where you are in tmux/screen and where you are logged in.

        An excellent use of the tools. I use a different $PS1 for root than I do for a non-privileged user, mostly for the same reasons.

    • (Score: 1, Interesting) by Anonymous Coward on Tuesday June 11 2019, @08:29AM

      by Anonymous Coward on Tuesday June 11 2019, @08:29AM (#854118)

      Mine is:

      export PS1error='$( ret=$? ; test $ret -ne 0 && echo "\[\e[41;93m\][$ret]\[\e[0m\]" )'
      export PS1="$PS1error[\t \u@\[\033[1;33m\]\[\033[1;40m\]\h\[\033[1;0m\]>\W]\\$ "

      You can make the host color different depending on whether it's production, staging, dev, etc.

      Don't think there's much point in having different user colors in my environment.

  • (Score: 5, Informative) by Thexalon on Monday June 10 2019, @05:00PM

    by Thexalon (636) on Monday June 10 2019, @05:00PM (#853752)

    The bash prompt is indeed very customizable, and you can make that the default if you change your .bash_profile (or system-wide in /etc/profile and a few other places). For example, this will put your current path in brackets into the bash prompt:

    PS1="[ \w ] $"

    A slightly more complex example can be found in Beyond Linux from Scratch [linuxfromscratch.org]: Those prompts change colors and such if you're root or a regular user, which can help avoid mistakes like "Whoops, I removed /etc". If you're interested in the ins and outs of a Linux system, doing an LFS build is extremely educational.

    --
    The only thing that stops a bad guy with a compiler is a good guy with a compiler.
  • (Score: -1, Offtopic) by Anonymous Coward on Monday June 10 2019, @08:59PM

    by Anonymous Coward on Monday June 10 2019, @08:59PM (#853863)

    "The bash prompt is adjustable"

    everything gnu is adjustable. and adjustable. and adjustable. no time to get anything done, gotta adjust.