0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

macOSでbashをアップデートする

Posted at

概要

  • macOSのbashのバージョンは3.x系から更新されていない ( macOS 10.15.5 )
  • macOSのログインシェルにbashを使用し続けると、以下のようなコメントが表示される
    • このコメントを消すには BASH_SILENCE_DEPRECATION_WARNING1 を設定すればいい
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.
  • コメントを消すことでも今まで通りにつかそうだが、バージョンが古いことなどもあるので、新しいバージョンを使用する
    • brewなどからも新しめのbashをインストールできるみたいだが、今回はソースコードからビルドして利用する

必要なもの

  • c言語をビルドすることのできる環境

ソースコードの取得ととインストール

GNUのページ のダウンロード欄からリンクに飛び、バージョンを選んでダウンロードする

tar.gz のファイルを入手できるので解凍する

$ tar zxvf bash-5.0.tar.gz

解凍されたディレクトリに移動してビルドしてテスト、インストールする

$ ./configure
$ make
$ make tests
$ make install

installが完了すると以下のコマンドでバージョンを確認できるようになる

$ /usr/local/bin/bash --version
// インストールしたバージョンが表示される

デフォルトシェルの変更

/etc/shells にこのpathを追加する

sudo sh -c "echo '/usr/local/bin/bash' >> /etc/shells"

デフォルトのログインシェルを変更する

$ chsh -s /usr/local/bin/bash

参考記事

https://qiita.com/key-amb/items/d053ed80590697435650
https://qiita.com/bo-san/items/1b920793aff499667011

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?