Macの環境構築
はじめに
中古のMacを買ったので、設定したことをメモ(コアなところ)
目次
アプリケーション
基本的にHomebrewでインストール
Homebrewのインストール
gcc
xcodeをインストールし、起動させるとつかえるようになるが、バージョンが古かったりする…(そういう依存いらない…)
とりあえず、Macは言語練習用として使用するため、今のままにするが今後変更する可能性がある。
Firefox
brew cask insatll firefox
VScode
brew cask install visual-studio-code
追加したパッケージ
・8bit・・・High Contrastでは点が見にくいので
・C/C++
・Janese Language Pack for Visuak Studio Code
・Nim
・zenkaku
・Hakers Haze Theme・・・ネタ
Chrome
brew cask install google-chrome
virtualbox
brew cask install virtualbox
Docker
brew cask install Docker
インストール後に
open Applications/Dpcker.app
CLI
alias関連
alias ls='ls -FG' alias ll='ls -alFG' alias et='exa -T' alias ea='exa -ahl --git'
exaコマンド
brew install exa
zsh
fishのようなシンタックスハイライトであるzsh-syntax-highlighting
brew install zsh-syntax-highlighting
最後にインストール後にやる設定の指示が書いたテキストが表示されるため注意
zshの補完機能を拡張してくれるzsh-completionsの導入
brew install zsh-completions
これの設定指示はメモってたので、記載しておく
To activate these completions, add the following to your .zshrc: if type brew &>/dev/null; then FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH autoload -Uz compinit compinit fi You may also need to force rebuild `zcompdump`: rm -f ~/.zcompdump; compinit Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting to load these completions, you may need to run this: chmod go-w '/usr/local/share'
参考
zsh compinit: insecure directoriesの対処(指示の最後を実行すれば問題ないと思う)
qiita.com
zsh側で用意されているpromptテーマを使用
autoload -U promptinit
promptinit
prompt adam2
pecoの導入
brew install peco
.zshrcに以下を追加
function select-history() { local tac if which tac > /dev/null; then tac="tac" else tac="tail -r" fi BUFFER=$(fc -l -n 1 | eval $tac | peco --query "$LBUFFER") CURSOR=$#BUFFER zle -R -c } zle -N select-history bindkey '^r' select-history
基本困ったら以下を見ればいいと思う
zshへの切り替え
chsh -s (which fish)
ヒストリーの記録ができていなかった問題 .zsh_historyファイルの権限の修正
chmod 744 .zsh_history
export HISTFILE="${HOME}/.zsh_history"
fishの導入
最高に楽ちんなfishもいいので入れておく
brew install fish
言語関連
Nim
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
すると以下のような表示がでる
choosenim-init: Downloading choosenim-0.6.0_macosx_amd64 Prompt: Can choosenim record and send anonymised telemetry data? [y/n] ... Anonymous aggregate user analytics allow us to prioritise ... fixes and features based on how, where and when people use Nim. ... For more details see: https://goo.gl/NzUEPf. Answer: n Downloading Nim 1.0.6 from nim-lang.org [##################################################] 100.0% 0kb/s Extracting nim-1.0.6.tar.xz Building Nim 1.0.6 Building koch Building Nim Building tools (nimble, nimgrep, nimpretty, nimsuggest, testament) Installed component 'nim' Installed component 'nimble' Installed component 'nimgrep' Installed component 'nimpretty' Installed component 'nimsuggest' Installed component 'testament' Switched to Nim 1.0.6 choosenim-init: ChooseNim installed in /Users/<username>/.nimble/bin choosenim-init: You must now ensure that the Nimble bin dir is in your PATH. choosenim-init: Place the following line in the ~/.profile or ~/.bashrc file. choosenim-init: export PATH=/Users/<username>/.nimble/bin:$PATH
export PATH=/Users/<username>/.nimble/bin:$PATH