texの設定(MBP )
MBPの初期設定 part3.1 brew doctorでのエラーの解決
rbenvでのrubyインストールでエラー出た際に、rbenvをhomebrewで入れたことから、
brew doctor
で、エラー起きてないかチェックした。
5つほど、warning出てた。以下、brew doctor結果。
Warning: /usr/local/lib isn't writable. This can happen if you "sudo make install" software that isn't managed by by Homebrew. If a brew tries to write a file to this directory, the install will fail during the link step. You should probably `chown` /usr/local/lib Warning: Some directories in /usr/local/share/man aren't writable. This can happen if you "sudo make install" software that isn't managed by Homebrew. If a brew tries to add locale information to one of these directories, then the install will fail during the link step. You should probably `chown` them: /usr/local/share/man/de /usr/local/share/man/de/man1 Warning: Broken symlinks were found. Remove them with `brew prune`: /usr/local/share/ghostscript/9.07/Resource/Font/xylubt12.pfb /usr/local/share/ghostscript/9.07/Resource/Font/xylubt11.pfb /usr/local/share/ghostscript/9.07/Resource/Font/xylubt10.pfb ...途中省略 Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these: jpeg libtiff Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. The following tools exist at both paths: emacsclient etags Consider setting your PATH so that /usr/local/bin occurs before /usr/bin. Here is a one-liner: echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
- 上から2つは同じように対処。(
osx - What does "You should probably `chown` them" mean? - Stack Overflow
)
sudo chown mmatthew_43 /usr/local/lib
残りも同じようにした。
- 3つ目
Warning: Broken symlinks were found. Remove them with `brew prune`:
(シンボリックリンク壊れてるから、brew pruneで取り除け)
brew prune
- 4つ目
後々、挙げられているkegsにリンクが貼られてないことで、build-troubleとか起こるかも。
brew link jpeg brew link libtiff
これらのコマンドは、はじめにやった/usr/local/libとかのfileのownershipの修正をしないと、動かない。
- 5つ目
もともと入ってるものが、Homebrew経由で入れたものの代わりに利用されてしまってるから、先に/usr/local/binを見るように設定する。
echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile
を打ち込んで、.bash_profileにパスの設定を書き込む。
c.f.「.bash_profile」=ターミナル立ち上げた時に読み込まれる設定ファイル。もし、.bashrcに設定を書く人なら、書き込む先を.bashrcにしてもいい。
以上で、
$ brew doctor Your system is ready to brew.
エラー解消できた。
MBPの初期設定 part3 Rubyの開発環境ほか
- rbenvでRubyのバージョン切り替え簡単にできるようにする
Homebrew + rbenv で Ruby をインストールする | deadwood
- rbenvでインストール時にエラー
rbenvを使用しており、Rubyの普段使っているバージョンが2.0系でない方へ
Ruby on Rails チュートリアル:実例を使って Rails を学ぼう
上記の記事通り以下のコマンドで、インストールを行った時にエラーが出た。
rbenv install 2.0.0-p353
エラーメッセージ
Downloading yaml-0.1.5.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/24f6093c1e840ca5df2eb09291a1dbf1 Installing yaml-0.1.5... Installed yaml-0.1.5 to /Users/MYUSERNAME/.rbenv/versions/2.0.0-p353 Downloading ruby-2.0.0-p353.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/78282433fb697dd3613613ff55d734c1 Installing ruby-2.0.0-p353... BUILD FAILED Inspect or clean up the working tree at /var/folders/1z/cz314fjn6jd2z88swdjb7xqm0000gn/T/ruby-build.20140326030923.1817 Results logged to /var/folders/1z/cz314fjn6jd2z88swdjb7xqm0000gn/T/ruby-build.20140326030923.1817.log Last 10 log lines: In file included from ./include/ruby/ruby.h:1568: In file included from ./include/ruby/intern.h:43: ./include/ruby/st.h:67:45: error: 'st_check_for_sizeof_st_index_t' declared as an array with a negative size typedef char st_check_for_sizeof_st_index_t[SIZEOF_VOIDP == (int)sizeof(st_index_t) ? 1 : -1]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ext/include/x86_64-darwin13.1.0/ruby/config.h:54:22: note: expanded from macro 'SIZEOF_VOIDP' #define SIZEOF_VOIDP 8 ^ 4 warnings and 3 errors generated. make: *** [dmyencoding.o] Error 1
logでてたので、ログを見る。
less /var/folders/1z/cz314fjn6jd2z88swdjb7xqm0000gn/T/ruby-build.20140326030923.1817.log
よくわからん。
homebrewでrbenvをインストールしていたので、homebrew関係でエラー出てないか、
brew doctor
で、エラーないかチェックした。
エラーメッセージとは関係ないけど、sudoなんちゃら、という文字が見えたので、sudoでインストールすればいいのでは、と思いたち、
sudo rbenv install 2.0.0-p353
インストールできた。
(本当はむやみにsudo使うべきではないし、もっときちんとした解決策ありそう。)
MBPの初期設定 part2
初期設定というより、やったことの備忘録。
- Emacsを最新版に
Installing Emacs on OS X - WikEmacs
ターミナル内で起動するCUIのemacsを導入できた。
- ~/.bashrcをターミナル起動時に自動で読み込む
ターミナル起動時に.bashrcを読み込むようにする - アインシュタインの電話番号
- yasnippet入れなおし
yasnippet 8.0の導入からスニペットの書き方、anything/helm/auto-completeとの連携 - Web学び
Ctrl+spaceを"mark set", F6 を"Spotlight検索フィールドを表示"に設定 - ymm:
- ruby-mode-mapで出ていたエラーを回避
Symbol's value as variable is void : ruby-mode-map
というエラーが出ていた。
Emacsでキーバインドをカスタマイズするための覚書 - gan2 の Ruby 勉強日記の通り、キーバインドの設定をhookしてやると、解決した。
- smart-compileで、C-c C-cで実行するよう設定
MBPの初期設定 part1
新しくMBPR13インチ(メモリ8G、SSD256G)を買ったので、時間のあるときに初期設定していく。
- Homebrewいれる
MacOSX - パッケージ管理システム Homebrew - Qiita
きれいにまとまっていて、この通りやればOK。
- tex環境の整備
MacTexのでかさにびびったので、homebrew経由でサブセットのBasicTexのみインストール。
もし、すでにMacTexとか入れてしまってる場合には、
Ball-RW - TeXで日本語文書作成 - TeXのアンインストール
を参考にアンインストールできる。
Emacs/TeX mode - TeX Wiki
emacsの設定や、その後の使い方がまとめられている。
- topcoder環境設定
西谷・平山研Hiki - 闇ゼミ::TopCoder
便利プラグインの設定は上のリンクから。
Programming Challenges, Software Development, and Employment Services at TopCoder
そもそものArenaを落としてくる。左の並んでるところから、「Competitions > Algorithm > Single Round Match(SRM) > Launch Arena」とたどっていく。Chromeだと、その後に表示される「Java Web Start」をクリックすると、Appletをダウンロードできる。
appletを落としてきたら、例えばDesktopにダウンロードした場合、
javaws ~/Desktop/ContestAppletProd.jnlp
でアリーナひらける。
あとはログインして、SRMに参加するなり、Practice Roomで過去問解いてみるなりする。
(edurome経由でつないでいて、ログインできない場合、HTTP Tunnelでログインすれば、ログイン可能)
スニペットとかコマンドとか
- スニペット作成するときのメモ
例えばスニペット挿入した時、カーソルの位置を指定できる。挿入されたらまず$1の位置にカーソルが置かれ、その後はTABで$2、$3…の順番で移動して、最後は$0(指定しなくてもいい)。
また、デフォルトで入力しておく文字の指定もできる。例えば、以下のスニペットのincludegraphicsの行の最後、${1: hoge.png}とすることで、hoge.pngが選択された状態で入力をスタートできる。何入力するかのメモに使うとよさげ。
# -*- mode: snippet; require-final-newline: nil -*- # name: figure # key: fig # -- \begin{figure}[htbp] \begin{center} \includegraphics[scale=${4:.4},bb=${0: 0 0 800 600}, clip]{${1: hoge.png}} \end{center} \caption{${2:caption}} \label{fig:${3:1}} \end{figure}
参考資料
・yasnippetの見直しをした - $shibayu36->blog;
- コマンド
-- Undo:2.5 操作の取り消しと繰り返し
--選択したリージョンの先頭に文字挿入: C-x r t
--起動してるバッファ一覧表示: C-x C-b
--起動してるバッファを軽くミニバッファに表示(設定ファイルに(iswitchb-mode t)した上で): C-x b(通常は一個前のバッファに戻ってくれる)