備忘録 Macにインストールしているもの
色々開発用にMacに入れたもので手順が煩雑になりがちなものがあったので備忘録として残します。
◇ homebrewでよく使うコマンド
terminal
# brew
$ brew list
$ brew search
$ brew doctor
$ brew install
$ brew uninstall
$ brew upgrade
# brew cask
$ brew search --cask [string]
$ brew install --cask [package name]
$ brew uninstall --cask [package name]
$ brew upgrade --cask [package name]
# 全部upgradeする
$ brew upgrade `brew list`
◇ .bashrcはこんな感じ
.bashrc
# git関連
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n\$ '
# nodebrew
export PATH=$HOME/.nodebrew/current/bin:$PATH
# Android Studio関連
export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools"
export PATH=$PATH:/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home/bin
export JAVA_HOME=/Applications/"Android Studio.app"/Contents/jre/jdk/Contents/Home
# flutter関連
export PATH="$PATH:$HOME/flutter/bin"
.bash_profile
source ~/.bashrc
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# エイリアス
alias ll='ls -Gal'
alias tree='tree --dirsfirst'
alias nodeb='nodebrew'
◇ .zshrcだとこんな感じ
.zshrc
# タブ補完
autoload -Uz compinit && compinit
# git
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr "+"
zstyle ':vcs_info:git:*' unstagedstr "*"
zstyle ':vcs_info:*' formats "(%b %u%c)"
zstyle ':vcs_info:*' actionformats '(%b|%a)'
precmd () { vcs_info }
# プロンプトカスタマイズ
PROMPT='
%B%F{green}%n@%m%f%b:%F{cyan}%~%f%F{red} $vcs_info_msg_0_%f
%F{white}$%f '
◇ 開発用に使うもの
■ formula
● bash-completion
bashのtab補完を効かすやつ
bash_profileに追記が必要
terminal
# GUIじゃないのでcaskじゃないよ
$ brew install bash-completion
# 設定ファイル的なものをvimで開く
$ vim ~/.bash_profile
.bash_profile
# .bash_profileに追記
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
terminal
# profile再読み込み
$ . ~/.bash_profile
● tree
ディレクトリをツリー表示するやつ
terminal
$ brew install tree
● nkf
文字コードを調べるやつ
terminal
$ brew install nkf
● q
csvファイルのデータ参照・抽出に使用。
$ brew install q
● git
最近は専らターミナルで操作
terminal
# brewでgitを入れ直す
$ brew install git
terminal
# 下記を.bashrcに追記してブランチを表示するように設定
$ vim ~/.bashrc
.bashrc
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\n\$ '
● Ansible
構成管理ツール
terminal
$ brew install ansible
● Deno
Typescriptのランタイムとして使う
terminal
$ brew install deno
● Go lang
細かなツールを作るのに便利そうなので、今後使って行こうかと思案中。
$ brew install go
■ cask
● Netbeans
phpの統合開発環境
terminal
# Android studioのインストールにも必要
$ brew install --cask java8
## 追記 java8がインストールできなくなったようなので、この辺が必要?(要検証)
$ brew install --cask java11
$ brew install --cask adoptopenjdk
# とりあえずphp版をインストール
$ brew install --cask netbeans-php
● VisualStudioCode
テキストエディタ(メイン装備)
terminal
# VS Code をインストール
$ brew install --cask visual-studio-code
● Plant UML
terminal
# インストール
$ brew install --cask java // -> open JDKを入れる
$ brew install graphviz
$ brew install plantuml
# visual studio code のプラグインをインストール
● Pycharm CE
PythonのIDE 無料版
terminal
# インストール
$ brew install --cask pycharm-ce
● Android studio
flutterの開発用使うやつ
terminal
# インストール
$ brew install --cask android-studio
● Sequel Pro
SQLクライアント: A5:SQLがwindowsのみ対応なので代わりに使用
terminal
# Sequel Proをインストール
$ brew install --cask sequel-pro
● SourceTree
gitクライアント: GUIでgitが使える
(インストールしてみたがgitコマンドのほうが便利だと気づいたのでほぼ使ってない)
※Mac版はssh鍵の認証がwindows版と異なるので注意
terminal
# Sourcetreeをインストール
$ brew install --cask sourcetree
#.sshディレクトリをつくる
$ mkdir .ssh
#.sshは隠しフォルダーになるのでfinderで見えるようにする
$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder
# ssh鍵のパーミッションを変更
$ chmod 700 .ssh
$ chmod 600 ~/.ssh/id_rsa
● VirtualBox
VMを立てる
Vagrantで使う
terminal
# インストール
$ brew install --cask virtualbox
● Vagrant
仮想環境を作る
terminal
# インストール
$ brew install --cask vagrant
● Docker for Mac
コンテナ
terminal
# インストール
$ brew install --cask docker
● FlieZilla
ファイル転送
追記: brewでインストール出来なくなった模様
terminal
# インストール
$ brew install --cask filezilla
● cyberduck
目的はFlieZillaと同様
terminal
# インストール
$ brew install --cask cyberduck
● postman
GUIでAPIにアクセス出来るので・・・
terminal
# インストール
$ brew install --cask postman
● wireshark
なんで入れたのか覚えてないですが・・・
terminal
# インストール
$ brew install --cask wireshark
● prepros
タスクランナーの設定が面倒くさいけどscssが使いたい時に入れてしまったやつ
terminal
# インストール
$ brew install --cask prepros
● Flutter
以前はHomebrew経由で入れられなかったができるようになった。
terminal
$ brew install flutter
● google-cloud-sdk
インストール後のメッセージ通りに .zshrc
に追加する。
terminal
$ brew install google-cloud-sdk
.zshrc
# intelの場合
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'
# M1の場合
source '/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
source '/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'
◇ Node.js関連 (global)
■ Node.js(本体)
- Node.js : webpackとかgulpなどを使うときに必要なもの
- npm : パッケージ(追加機能)を管理するためのもの
- nodebrew : Node.jsの特定のバージョンでしか動作しない場合があるのでバージョンを指定してインストールを出来るようにするためのもの
terminal
# Homebrewでnodebrewをインストール
$ brew install nodebrew
$ nodebrew setup
# パスを通す
$ echo "export PATH=\$HOME/.nodebrew/current/bin:\$PATH" >> ~/.bash_profile
# bash_profileを変更したので再読み込み
$ source ~/.bash_profile
# latestをインストール
$ nodebrew install-binary latest
# Warning: such file or directory ←このエラーがでたら
$ mkdir -p ~/.nodebrew/src
$ nodebrew install-binary latest
# バージョン一覧を確認
$ nodebrew list
# 使いたいバージョンを有効化する
$ nodebrew use v9.2.0
■ yarn
terminal
# nodebrewでnode.jsを管理しているので同梱版はNG
$ brew install yarn --ignore-dependencies
# upgrade
## どうやら brew でupgradeするとnode.jsも入ってしまうらしい・・・
$ brew upgrade yarn
## nodebrewで管理してるのでuninstall
$ brew uninstall --ignore-dependencies node