helen's blog

ずっとおもしろいことしてたいな。

macports抹消してbashからzshに変えた話

OSアップデートしたらMacPortsが死んでた件 - helen's blogの続き

homeでlsしたら変なのがいっぱいいた

$ ls 
-rw-r--r--   1 helen staff     51  5  6  2013 .bash_profile.macports-saved_2013-05-17_at_17:20:11
-rw-r--r--   1 helen  staff    433  5 17  2013 .bash_profile.macports-saved_2013-05-17_at_17:27:05
-rw-r--r--   1 helen  staff    884  8 19  2013 .bash_profile.macports-saved_2013-10-24_at_00:09:18
-rw-r--r--   1 helen  staff   1376  5 19  2014 .bash_profile.macports-saved_2016-02-21_at_23:20:47

しかも

$ ls
-rw-r--r--   1 helen  staff  12288  5 19  2014 .bash_profile.swn
↑ なぜかviのクラッシュ時のファイルっぽいのがいる
-rw-r--r--   1 helen  staff  12288  5 24  2013 .bash_profile.swo
↑ なぜかviのクラッシュ時のファイルっぽいのが更にいる
-rw-------   1 helen  staff  12288  5  6  2013 .bash_profile.swp
↑ なぜかviの一時ファイルっぽいのがいる

そして.bashrcはないという
そういえば数年前に書いたり消したりした記憶が無くもない

ちなみに.bash_profile.macports-savedの中身を見ると

$ cat .bash_profile.macports-saved_2013-05-17_at_17:20:11
export PATH="/usr/local/bin:$PATH:/usr/local/sbin"

こんだけっていう
会社では最強の.zshrcをもらって使っててめっちゃ便利なので

作業前についでにとりあえずzshに変更します

macならデフォルトで入ってるそうですが一応確認

$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh # ←いた
ログインシェルを変更
$ chsh -s /bin/zsh
Changing shell for helen.

パスワード入力してiTerm再起動したらzshが起動しました
やったね!
.zshrcはまた今度いじるとして.bash_profileを見ると

##
# Your previous /Users/ia11063/.bash_profile file was backed up as /Users/ia11063/.bash_profile.macports-saved_2016-02-21_at_23:20:47
##

# MacPorts Installer addition on 2016-02-21_at_23:20:47: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

こんな記述が
macportsは自分のpathを入れるときにその前のファイルをバックアップとして取っておいてくれるらしい
最初にインストールしたときのバックアップに戻せば綺麗になるけど
自分で追加した分は残しておきたいので

$ ls 
-rw-r--r--   1 helen staff     51  5  6  2013 .bash_profile.macports-saved_2013-05-17_at_17:20:11 
-rw-r--r--   1 helen  staff    433  5 17  2013 .bash_profile.macports-saved_2013-05-17_at_17:27:05
-rw-r--r--   1 helen  staff    884  8 19  2013 .bash_profile.macports-saved_2013-10-24_at_00:09:18 ←こいつ
-rw-r--r--   1 helen  staff   1376  5 19  2014 .bash_profile.macports-saved_2016-02-21_at_23:20:47

を.bash_profileに変更して他は削除しました

zshにしてbash_profileを掃除する意味はないけど
不要なファイルが残ってて気持ち悪いのがすっきりしました