物理学徒の備忘録

プログラミングやPC、物理に関することなどの備忘録を書いていきます。

KEKサマーチャレンジ2018-1

TL;DR

もう去年のことになりましたが、「第12回KEKサマーチャレンジ」に参加してきました。
実験系・理論系志望に関わらず、研究職に興味があるならばぜひ参加すべき。とてもいい経験ができます。
ネット上に情報が少ない気がしたので書いておきます。

KEKサマーチャレンジとは

「サマーチャレンジとは・・・基礎科学を担う若手を育てることを目的に大学3年生と高専専攻科学生を主な対象として行われ、今年で12回目を迎えます。 研究最前線で活躍する研究者による講義や施設見学のほか、豊富な実習プログラムが用意されています。 実習では、研究者から直接指導を受け「研究」の一連の流れを体験することができます。基礎科学の様々な研究や分野を身を持って知る機会となるだけでなく、科学を志す仲間との出会いや今後の進路を考えるきっかけとなる科学技術体験型スクールです。 今年は、2008年にノーベル物理学賞を受賞されたKEK特別栄誉教授・小林誠先生による特別講演も用意されています。」
KEKサマーチャレンジHPより

参加申し込み

5月ぐらい?に、ポスターが掲示されているのを見つけてWeb上で申し込み。選考のために作文を書かなければいけないので、ラジオを作ったことを書きました。ちなみに、申し込んだのは締切前日の5月20日でした。
僕が第一希望で申し込んだのは「演習課題03 先進加速器を体験しよう ~実験と電磁波シミュレーターで体験する先進加速器~」です。
測定器関係の演習はたまに目にしますが、加速側の演習はあまり目にしたことが無かったので、ちょっと体験してみたいと思ってこの課題を選択しました。

参加内定通知

参加申込みをしてから約3週間後の6月8日に参加内定通知がメールで届き、無事に第一希望の演習に内定しました。 内定通知メールが届くと、twitterフォロー大会が始まります。結構FFが増えます、マジで。

内定通知からサマーチャレンジ開催日までの間

参加が内定して嬉しかった反面、ちゃんと他の参加者に付いていく事ができるのかなどの不安もあって、悶々とした日々を送っていました。
旅費申請、参加承諾書等々の事務手続きを終えた後、7月中旬頃に講義テキストが届きました。加えて、演習班によっては先生お手製のテキストが送られてきたようです。
僕の班は追加のテキストなどは無かったので、講義テキストを予習しつつ自分で加速空洞などについて調べる日々を過ごしました。

HPを立ち上げる

TL;DR

学科のサイエンスラウンジのHPを立ち上げた。
Wordpress便利。

How To

1.サーバーの確保

サイトを設置するためにサーバーを確保する。
今回は学科の取り組みの一環であったため、理学部のサーバーのアカウントを取ってもらった。

2.MySQLアカウントの取得

管理者の方にお願いし、MySQLのアカウントを取得。

3.Wordpressのインストール

sshで作業する。

$ ssh username@hostname

サーバーに入れたら、public_htmlに移動し、Wordpressを落としてくる。

user@host:~$ cd public_html/  
user@host:~/public_html$ curl -OL http://ja.wordpress.org/latest-ja.tar.gz

ダウンロードが完了したら、展開。

user@host:~/public_html$ tar -xzvf latest-ja.tar.gz

これで、wordpressディレクトリができる。
ブラウザーを立ち上げ、
http://host/user/wordpress/wp-login.php
へアクセスする。
データベース情報の入力を求められるので、MySQLのアカウント情報を入力する。
※つまずきポイント
MySQLの情報を入力した後、wp-config.phpを作成できませんでした的な表示が出たので、自分で作成してやる必要があった。
とはいえ、表示された内容をコピペするだけなのだが。
次にサイトの名前などの設定をし、ダッシュボードが表示されれば完了。

4.アクセスしてみる

http://host/user/wordpress/
へアクセスし、Hello Worldが表示されればOK!

Beamerを使おう

TL;DR

Beamerを使ってかっこいいスライドを作ろう。
Beamerの基本的な使い方について書きます。

Beamer is 何

プレゼン用のスライドを作ることができる{ \displaystyle \LaTeX }のクラス。
{ \displaystyle \LaTeX }なので、もちろん綺麗な数式が書ける。
MacTeXをインストールしていれば、既に入っているので特に環境構築は不要。

Beamer事始め

まずはシンプルなスライドを作る。ちなみに僕の好みでLuaLaTeXです。

\documentclass[unicode,12pt]{beamer} % 'unicode'が必要  
\usepackage{luatexja} % 日本語したい  

\title[Hogehoge]{Fugafuga} %Short title,Long title  
\author{Taro BEAMER} %名前  
\institute{HogeFuga Univ.} %所属  
\date{2019/2/14} %日付  

\begin{document}  

\maketitle  

\begin{frame}{Test}  
  Hello,Beamer!
\end{frame}  

\end{document}

コンパイルすると、こんな感じのスライドが出来上がる。

カスタマイズしていく

とりあえずスライドはできたけど、これでは味気ない。
てなわけで、カスタマイズしていく。

フォント関係

さっきのコードに追記して、

\documentclass[unicode,12pt]{beamer} 
\usepackage{luatexja} 
\usepackage[no-math]{fontspec} %追加
\usepackage[no-math]{luatexja-fontspec} %追加
\setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} %追加
\setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light} %追加
\setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} %追加
\setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3} %追加
\usefonttheme{professionalfonts} %数式のフォントをlatex文書と同じに

\title[Hogehoge]{Fugafuga} 
\author{Taro BEAMER} 
\institute{HogeFuga Univ.}
\date{2019/2/14}

\begin{document}  

\maketitle  

\begin{frame}{Test}  
  Hello,Beamer!
\end{frame}  

\end{document}

通常の{ \displaystyle \LaTeX }文章と同様にフォントを指定できます。
LuaLaTeXでのフォント指定については、LaTex事始め - 物理学徒の備忘録参照。

\usefonttheme{professionalfonts}

を追加することで、数式のフォントがHelveticaに変わってしまうのを防げます。

テーマの変更

Beamerではテーマを指定することができる。
テーマは、beamer themeとかでググるといっぱい見つかる。
今回は、僕が今気に入って使っているテーマを指定してみる。
テーマを使うためには、

\documentclass[unicode,12pt]{beamer} 
\usepackage{luatexja} 
\usepackage[no-math]{fontspec}
\usepackage[no-math]{luatexja-fontspec}
\setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}
\setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}
\setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}
\setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}
\usefonttheme{professionalfonts}

\useoutertheme{infolines} %追加
\usecolortheme{dolphin} %追加
\usecolortheme[RGB={0,128,0}]{structure} %追加

\title[Hogehoge]{Fugafuga} 
\author{Taro BEAMER} 
\institute{HogeFuga Univ.}
\date{2019/2/14}

\begin{document}  

\maketitle  

\begin{frame}{Test}  
  Hello,Beamer!
\end{frame}  

\end{document}

BeamerのテーマにはOuter themeとColor themeとか色々あり、それぞれ別のものを指定できる。今回は、Outer themeとしてinfolines、Color themeとしてdolphinを指定しています。で、dolphinの色をRGBで指定し、緑に変えています。
このテーマを指定すると、勝手にヘッダーやフッターを入れてくれます。

これだけでかなりかっこよくなりました(個人的感想)。
右下のナビゲーションシンボルいらんなって人は、

\setbeamertemplate{navigation symbols}{}

を追記すると消えます。

最後に

適当に作った例を置いておきます。

\documentclass[unicode,12pt]{beamer}
\usepackage{luatexja}
\usepackage[no-math]{fontspec}
\usepackage[no-math]{luatexja-fontspec}
\setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}
\setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}
\setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}
\setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}
\usefonttheme{professionalfonts}

\useoutertheme{infolines}
\usecolortheme{dolphin}
\usecolortheme[RGB={0,128,0}]{structure}

\title[Hogehoge]{Fugafuga}
\author{Taro BEAMER}
\institute{HogeFuga Univ.}
\date{2019/2/14}

\begin{document}

\maketitle

\begin{frame}{Table of contents}
  \tableofcontents
\end{frame}

\section{Electromagnetism}

\subsection{Maxwell's Equations}

\begin{frame}{Maxwell's Equations in vacuum}
  \begin{eqnarray*}
    \mathrm{rot} \vec{E} &=& - \frac{\partial \vec{B}}{\partial t}\\
    \mathrm{rot} \vec{H} &=& \frac{\partial \vec{D}}{\partial t}\\
    \mathrm{div} \vec{D} &=& 0\\
    \mathrm{div} \vec{B} &=& 0
 \end{eqnarray*}
\end{frame}

\section{Conclusion}

\begin{frame}{Beamer is}
  \Huge \centering So Cool!
\end{frame}

\end{document}

Geant4コマンド覚え書き

TL;DR

今回は本当に備忘録。
久しぶりにGeant4を使う時に忘れてそうなコマンド一覧。

コマンド覚え書き

打ち込む粒子を変更する

IDLE > /gun/particle mu-

mu-の部分を色々変える。

打ち込む粒子のエネルギーを変更する

IDLE > /gun/energy 30 MeV

単位の指定は忘れずに。

粒子を打ち込む位置(particle gun)を変更する

IDLE > /gun/position 0 0 0 mm

x,y,zの順に指定する。単位の指定は忘れずに。

粒子を打ち込む

/run/beamOn 1

1の部分を変えることで打ち込む粒子の数を指定。

軌跡の色を変更する

IDLE > /vis/modeling/trajectories/create/drawByParticleID viewer-0  
IDLE > /vis/modeling/trajectories/viewer-0/set gamma red

set以降に粒子の種類,色の順で指定する。

マクロを読み込む

IDLE > /control/execute hoge.mac

非常に便利。

LaTex事始め

TL;DR

Macで俺的{ \displaystyle \LaTeX }環境のまとめ。
{ \displaystyle \LaTeX }の導入とか

{ \displaystyle \LaTeX }のインストール

Homebrewを使う。

$ brew upgrade  
$ brew cask install mactex  
$ sudo tlmgr update --self --all  

ちなみに、tlmgrはTeXLiveのパッケージ管理ツール的なやつ。インストールには結構時間かかるよ。

{ \displaystyle \LaTeX }を使ってみる

{ \displaystyle \LaTeX }を使ってみよう。個人的にはフォントの変更が簡単なLuaLaTeXがオススメ。
LuaLaTeXでは、プリアンブルでフォントを指定してあげる事で簡単にフォントを変更できる。例えば、僕の場合和文フォントにはヒラギノ角ゴ、欧文フォントにはHelvetica Neueを指定している。具体的には、

\usepackage[no-math]{fontspec}  
\usepackage[no-math]{luatexja-fontspec}  
\setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}  
\setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}  
\setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}  
\setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}  

とプリアンブルに書く。fontspecのオプションにno-mathを付けないと、数式のフォントまで変わってしまうので注意。setmainfontでは欧文明朝体、setsansfontでは欧文ゴシック体、setmainjfontでは和文明朝体、setsansjfontでは和文ゴシック体を指定できる。
僕は個人的な好みでmainfontにもsansfontにもゴシック体を指定している。
他のフォントに変えたいときは、Font BookでPostScript名を調べて上のコードを書き換えよう。

現在のプリアンブル

最後に、僕の現在のプリアンブルを書いておく。

\documentclass[11pt,a4paper]{ltjsarticle}  
\usepackage{graphicx} %pdf挿入のため  
\usepackage{here} %{figure}[H]を使うため  
\usepackage[stable]{footmisc} %見出しの脚注が目次にもつくのを防止,見出し中に脚注をつける時に\protect不要  
\usepackage{url} %参考文献でurlを使うため  
\usepackage[subrefformat=parens]{subcaption} %subcaptionを使うため  
\usepackage[no-math]{fontspec}  
\usepackage[no-math]{luatexja-fontspec}  
\usepackage{wrapfig}  
\setmainfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}  
\setsansfont[Ligatures=TeX,BoldFont=Helvetica Neue Medium,ItalicFont=Helvetica Neue Light Italic,BoldItalicFont=Helvetica Neue Bold Italic]{Helvetica Neue Light}  
\setmainjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}  
\setsansjfont[BoldFont=HiraginoSans-W4]{HiraginoSans-W3}  
\newcommand{\ctext}[1]{\raise0.2ex\hbox{\textcircled{\scriptsize{#1}}}} %丸文字を\ctext{}で入力できるようにする  
\newcommand{\unit}[1]{\ \mathrm{#1}} %\unit{}で単位を入力できるようにする。  
\newcommand{\siki}[1]{(\ref{#1})式} %式の参照を楽に  
\newcommand{\zu}[1]{\ref{#1}} %図の参照を楽に  
\newcommand{\hyou}[1]{\ref{#1}} %表の参照を楽に  
\bibliographystyle{junsrt} %bibliographyの設定(参照順)  
\makeatletter %数式番号に節番号も含む  
\@addtoreset{equation}{section}  
\def\theequation{\thesection.\arabic{equation}}  
\makeatother  

ターミナルアプリをiTerm2からHyperへ乗り換える

TL;DR

  • たまにiTermのホットキーを押してもウィンドウが出なくなる事があり,ストレスだった
  • こことかを見て,ええやん!と思った

等の理由で,ターミナルアプリをiTermからHyperに乗り換えた話.
なんかええ感じのかっこいいターミナルになった. f:id:haru_same_same:20190102201452p:plain

Hyper

なんか現代風でイケてるターミナルアプリ.HPはここ.

Hyperのインストール

Hyperのサイトから.appを落としてきてインストール.

各種設定

フォントの設定

僕はRictyが好きなので,フォントをRictyに変えたい.
Hyperを起動してCmd+,で.hyper.jsが開くので,

// font family with optional fallbacks
    fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

となっている所を

// font family with optional fallbacks
    fontFamily: '"Ricty",Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

と追記してあげましょう.
デフォルトのフォントサイズが少々小さい気がするので,同時に大きくしてあげるのが吉.

// default font size in pixels for all tabs
    fontSize: 13,

fontSize:の右の数字を好きな数字に書き換える.

プラグイン

Hyperは,プラグインを追加することによって様々なカスタマイズが可能となっている.

hyper-material-theme

ウィンドウをマテリアルなデザインに変えるプラグイン.

インストール

公式ページに従って,.hyper.jsのpluginsに以下のように追記する.

plugins: ['hyper-material-theme'],

更に,colorsの設定の下に

MaterialTheme: {
        // Set the theme variant,
        // OPTIONS: 'Darker', 'Palenight', 'Ocean', ''
        theme: '',
 
        // [Optional] Set the rgba() app background opacity, useful when enableVibrance is true
        // OPTIONS: From 0.1 to 1
        backgroundOpacity: '1',
 
        // [Optional] Set the accent color for the current active tab
        accentColor: '#64FFDA',
 
        // [Optional] Mac Only. Need restart. Enable the vibrance and blurred background
        // OPTIONS: 'dark', 'ultra-dark', 'bright'
        // NOTE: The backgroundOpacity should be between 0.1 and 0.9 to see the effect.
        vibrancy: 'dark'
    },

を追記して導入完了.

hypercwd

新しいタブを開いたときに,元あったタブと同じディレクトリで開いてくれる.

インストール

公式ページに従って,.hyper.jsのpluginsに以下のように追記する.

plugins: ['hyper-material-theme',
               'hypercwd'],

で,configの末尾に以下のように追記する.

hypercwd: {
        initialWorkingDirectory: '~/'
      }

initialWorkingDirectoryは自分の好みで変更して,どうぞ.

hyper-statusline

ウィンドウ下部にgitのstatusとかを表示してくれるプラグイン.

インストール

公式ページに従って,.hyper.jsのpluginsに以下のように追記する.

plugins: ['hyper-material-theme',
               'hypercwd',
               'hyper-statusline'],

hyper-tab-icons

タブに,現在開いているものに応じたアイコンを追加してくれるプラグイン.

インストール

ここ参照

hyper-overlay

ホットキーを押してHyperを起動できるようにするプラグイン.
常に最前面表示とかもできて便利.

インストール

公式ページに従っ(ry
めんどくさくなりました.
正直公式ドキュメント読めばわかるしね…

最後に

自分の.hyper.jsだけ貼って終わります.

// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.

module.exports = {
  config: {
    // choose either `'stable'` for receiving highly polished,
    // or `'canary'` for less polished but more frequent updates
    updateChannel: 'stable',

    // default font size in pixels for all tabs
    fontSize: 18,

    // font family with optional fallbacks
    fontFamily: '"Ricty",Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

    // default font weight: 'normal' or 'bold'
    fontWeight: 'normal',

    // font weight for bold characters: 'normal' or 'bold'
    fontWeightBold: 'bold',

    // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
    cursorColor: 'rgba(248,28,229,0.8)',

    // terminal text color under BLOCK cursor
    cursorAccentColor: '#000',

    // `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █
    cursorShape: 'BLOCK',

    // set to `true` (without backticks and without quotes) for blinking cursor
    cursorBlink: false,

    // color of the text
    foregroundColor: '#fff',

    // terminal background color
    // opacity is only supported on macOS
    backgroundColor: '#000',

    // terminal selection color
    selectionColor: 'rgba(248,28,229,0.3)',

    // border color (window, tabs)
    borderColor: '#333',

    // custom CSS to embed in the main window
    css: '',

    // custom CSS to embed in the terminal window
    termCSS: '',

    // if you're using a Linux setup which show native menus, set to false
    // default: `true` on Linux, `true` on Windows, ignored on macOS
    showHamburgerMenu: '',

    // set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons
    // additionally, set to `'left'` if you want them on the left, like in Ubuntu
    // default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS
    showWindowControls: '',

    // custom padding (CSS format, i.e.: `top right bottom left`)
    padding: '12px 14px',

    // the full list. if you're going to provide the full color palette,
    // including the 6 x 6 color cubes and the grayscale map, just provide
    // an array here instead of a color map object
    colors: {
      black: '#000000',
      red: '#C51E14',
      green: '#1DC121',
      yellow: '#C7C329',
      blue: '#0A2FC4',
      magenta: '#C839C5',
      cyan: '#20C5C6',
      white: '#C7C7C7',
      lightBlack: '#686868',
      lightRed: '#FD6F6B',
      lightGreen: '#67F86F',
      lightYellow: '#FFFA72',
      lightBlue: '#6A76FB',
      lightMagenta: '#FD7CFC',
      lightCyan: '#68FDFE',
      lightWhite: '#FFFFFF',
    },

    // Configulation of MaterialTheme
    MaterialTheme: {
        // Set the theme variant,
        // OPTIONS: 'Darker', 'Palenight', 'Ocean', ''
        theme: 'Darker',

        // [Optional] Set the rgba() app background opacity, useful when enableVibrance is true
        // OPTIONS: From 0.1 to 1
        backgroundOpacity: '0.8',

        // [Optional] Set the accent color for the current active tab
        accentColor: '#64FFDA',

        // [Optional] Mac Only. Need restart. Enable the vibrance and blurred background
        // OPTIONS: 'dark', 'ultra-dark', 'bright'
        // NOTE: The backgroundOpacity should be between 0.1 and 0.9 to see the effect.
        vibrancy: 'dark'
    },

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    //
    // Windows
    // - Make sure to use a full path if the binary name doesn't work
    // - Remove `--login` in shellArgs
    //
    // Bash on Windows
    // - Example: `C:\\Windows\\System32\\bash.exe`
    //
    // PowerShell on Windows
    // - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
    shell: '',

    // for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
    // by default `['--login']` will be used
    shellArgs: ['--login'],

    // for environment variables
    env: {},

    // set to `false` for no bell
    bell: 'SOUND',

    // if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard
    copyOnSelect: false,

    // if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH
    defaultSSHApp: true,

    // if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no
    // selection is present (`true` by default on Windows and disables the context menu feature)
    // quickEdit: true,

    // URL to custom bell
    // bellSoundURL: 'http://example.com/bell.mp3',

    // for advanced config flags please refer to https://hyper.is/#cfg

    hypercwd: {
        initialWorkingDirectory: '~/'
      },

    overlay: {
      alwaysOnTop: true,
      animate: false,
      hasShadow: false,
      hideDock: true,
      hideOnBlur: false,
      hotkeys: {
        open: ['F11'], // On MacOS hotkey is default to Option + Space!
        close: ['F11'], // On MacOS hotkey is default to Option + Escape!
      },
      position: 'bottomRight',
      primaryDisplay: false,
      resizable: true,
      size: {
        width: 0.5,
        height: 0.5
      },
      startAlone: false,
      startup: false,
      tray: false,
      unique: true
    }
  },

  // a list of plugins to fetch and install from npm
  // format: [@org/]project[#version]
  // examples:
  //   `hyperpower`
  //   `@company/project`
  //   `project#1.0.1`
  plugins: ['hyper-material-theme',
            'hypercwd',
            'hyper-overlay',
            'hyper-statusline',
            'hyper-tab-icons'],

  // in development, you can create a directory under
  // `~/.hyper_plugins/local/` and include it here
  // to load it and avoid it being `npm install`ed
  localPlugins: [],

  keymaps: {
    // Example
    // 'window:devtools': 'cmd+alt+o',
  },
};

Homebrewの導入と簡単な使い方

Homebrew

Macで使えるパッケージマネージャ。Linuxのaptとかyumみたいな感じ。

$ brew install hogehoge

とかやるだけで色々なパッケージを自動でインストールしてくれるすごいやつ。(小並感)
Homebrewでは、パッケージのことをFormulaと呼ぶ。

Homebrewの導入

まずComand Line Toolsをインストールしよう。
ターミナルで

$ xcode-select --install

を実行し、完了したら

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

を実行するだけ。ほんとにそれだけ。結構時間がかかるので気長に待つ。
インストールできたら、

$ brew doctor

と打ってみて良さげなメッセージが返ってきたらOK!

Homebrewの基本的な使い方

Homebrew本体のアップデート

$ brew update

Homebrew本体のアップデートとFormulaのアップデート

$ brew upgrade

Formulaのインストール

$ brew install (Formula name)

Formulaのアンインストール

$ brew uninstall (Formula name)

Homebrewのファイルが容量を食ってきたときは・・・

Homebrewを使い始めてしばらくすると、Formulaの前のバージョンのcashが溜まってきて結構な容量を食う。
そんなときは

$ brew cleanup -s

を実行すると、最新のcashまで削除してくれる。