作業中に「お使いの起動ディスクは一杯です」というダイアログが表示された。
この3つのコマンド走らせるだけで、30Gほど空きスペースを確保できた。
ちょっと放置し過ぎか
作業中に「お使いの起動ディスクは一杯です」というダイアログが表示された。
この3つのコマンド走らせるだけで、30Gほど空きスペースを確保できた。
ちょっと放置し過ぎか
tail -f pinzo.log: Deviseの有効期限設定をテストする で書いた有効期限検証のコードで不思議な事が起こった。Macでは正常にパスするのだが、Amazon Linux上ではパスしない。
ミニマムなコードで示すとこんな感じ
で、こんなデバッグコードを仕込んで実行してみた
Macで実行するとこんな感じ
[test-code][sent_at] to_s: 2016-02-01 23:51:31 +0900, to_i: 1454338291, usec: 197593, subsec: 197593/1000000 [test-code][added] to_s: 2016-02-11 23:51:31 +0900, to_i: 1456930291, usec: 197593, subsec: 197593/1000000 [devise][now] to_s: 2016-02-11 23:51:31 +0900, to_i: 1456930291, usec: 197593, subsec: 197593/1000000 [devise][sent_at] to_s: 2016-02-01 23:51:31 +0900, to_i: 1454338291, usec: 197593, subsec: 197593/1000000 [devise][added] to_s: 2016-02-11 23:51:31 +0900, to_i: 1456930291, usec: 197593, subsec: 197593/1000000 [devise] now > added: false [devise] now.subsec > added.subsec: false
Amazon Linuxで実行するとこんな感じ
[test-code][sent_at] to_s: 2016-02-01 23:53:20 +0900, to_i: 1454338400, usec: 369658, subsec: 369658841/1000000000 [test-code][added] to_s: 2016-02-11 23:53:20 +0900, to_i: 1456930400, usec: 369658, subsec: 369658841/1000000000 [devise][now] to_s: 2016-02-11 23:53:20 +0900, to_i: 1456930400, usec: 369658, subsec: 369658841/1000000000 [devise][sent_at] to_s: 2016-02-01 23:53:20 +0900, to_i: 1454338400, usec: 369658, subsec: 184829/500000 [devise][added] to_s: 2016-02-11 23:53:20 +0900, to_i: 1456930400, usec: 369658, subsec: 184829/500000 [devise] now > added: true [devise] now.subsec > added.subsec: true
usecまでは同じなのだが、subsec をみると Amazon Linux では、桁落ちが発生している。
ためしにそれぞれで Time.now.subsec としてみる。
# mac $ ruby -e 'puts Time.now.subsec' 276987/1000000 # Amazon Linux $ ruby -e 'puts Time.now.subsec' 704462593/1000000000
つまりこういうことが起こっている
Time#subsec が返す精度が異なるcreate で返すのは、コードで指定された値を格納したオブジェクトであり、DBに登録後取得したものではないので confirmation_sent_at はそのままの精度である。つまり、スタブで突っ込んでいるのは元の精度Time#subsecの精度がsqliteの精度と同じだったため桁落ちが発生せず正常に動作するこれを避けるためには、スタブに突っ込む値をDBから取得したものにすれば良さそうだ。たとえばこんな感じ
ちなみに Mac でも、桁落ちを引き起こすことは可能で、こんな感じで usec を超えた範囲を指定すれば桁落ちさせられる。
あー疲れた、腹減った
/usr/local だなんだと言われているけど、寝ている間に終わればいいやと放置したので特に何もせず。# reattach-to-user-namespace をインストール % brew install reattach-to-user-namespace # .tmux.conf に設定追加 % echo 'set-option -g default-command "reattach-to-user-namespace -l zsh"' >> ~/.tmux.conf # Brewfile にも忘れずに追加 % echo 'install reattach-to-user-namespace' >> ~/src/github.com/pinzolo/env/Brewfileこれで tmux からの vim や gvim でクリップボードが使えるし、pbcopy も正常に動きます。
.tmux.conf も少し調べたらかけた。exit で全部終了してから、再度起動しても設定ファイルを再読み込みしてくれるわけではないらしい。killall tmux して再度立ち上げたらちゃんと反映された。.tmux.conf はこんな感じ。
# utf-8 set-window-option -g utf8 on set-option -g status-utf8 on # prefix: C-b -> C-t unbind C-b set-option -g prefix C-t # ignore all bells set-option -g bell-action none # highlight status line on window activity set-window-option -g monitor-activity on # use vi keybinds set-option -g mode-keys vi # reduce escape key delay set-option -sg escape-time 1 # reload ~/.tmux.conf bind r source-file ~/.tmux.conf \; display "Reloaded!" # show last window bind C-t last-window # enter copy mode unbind Escape bind Escape copy-mode # enable rbenv local set-environment -gu RBENV_VERSION # default status color set-option -g status-fg black set-option -g status-bg white # current window's status color set-window-option -g window-status-current-fg blue set-window-option -g window-status-current-bg whiteこれでカラフルな vim がコンソールでも使えるようになった。
libruby.2.1.dylib が存在していない。--enable-shared オプションを付けてビルドするという情報を見つけ、Ruby2.1.2を入れなおした。
CONFIGURE_OPTS="--enable-shared --with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.1.2しかしそれでも
libruby.2.1.dylib は作成されない。function peco-src() {
local selected_dir=$(ghq list --full-path | peco --query "$LBUFFER")
if [ -n "$selected_dir" ]; then
BUFFER="cd ${selected_dir}"
zle accept-line
fi
zle clear-screen
}
zle -N peco-src
bindkey '^S' peco-src
こんなのを.zshrcに書いたが、Ctrl-S で起動しないし、直接 peco-src とやってディレクトリを選択するとエラーになる。peco-src:zle:4: widgets can only be called when ZLE is active peco-src:zle:6: widgets can only be called when ZLE is activeあれこれいじったり調べていると、どうも自分の zsh の環境が少しおかしいことに気づく。
% echo $module_path明らかにおかしい。どうやら、実行しているシェルは Mac に元から入っていた zsh のようだ。/usr/lib/zsh/5.0.2/zsh% zsh --versionzsh 5.0.5 (x86_64-apple-darwin13.0.0)
chsh -s /bin/zsh したんだろう。% sudo sh -c "echo /usr/local/bin/zsh" >> /etc/shells % chsh -s /usr/local/bin/zshしかし、下記のエラーが出た。
/Users/pinzolo/.zshenv:1: command not found: rbenv /Users/pinzolo/.zshenv:2: command not found: pyenv compinit:183: module `zsh/parameter' has no such feature: `p:dis_patchars': autoload cancelled compinit:183: module `zsh/parameter' has no such feature: `p:patchars': autoload cancelledrbenv と pyenv のエラーは
.zshenv の先頭に export PATH="/usr/local/bin:$PATH" を追加したら消えた。% brew uninstall zsh % brew install zsh --enable-etcdirしかし、それでも
peco-src は動かない。/usr/local/Cellar/zsh/5.0.5/lib に zle.so はあるし、.zshrc 内では zle は動いていると思われる。# readline のバージョンを最新に % brew switch readline 6.3.5 # Ruby 2.0.0-p481 をインストール % CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl` --with-gcc=clang" rbenv install 2.0.0-p481 % rbenv global 2.0.0-p481 && rbenv rehash % gem install pry bundler # Ruby 2.0.0-p481 をインストール % CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl` --with-gcc=clang" rbenv install 2.1.2 % rbenv global 2.1.2 && rbenv rehash % gem install pry bundler
おもむろに最新パッチレベルとそろそろruby2.1.1を入れようと思って、
CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl` --with-gcc=clang" rbenv install 2.0.0-p451を叩いたらエラーでインストールできなかった。
readline.c:1886:26: error: use of undeclared identifier 'Function'
rl_pre_input_hook = (Function *)readline_pre_input_hook;
^
readline.c:1886:36: error: expected expression
rl_pre_input_hook = (Function *)readline_pre_input_hook;
調べてみると、どうやら readline が 6.3 になって rbenv でインストールしようとしたらエラーになるということらしい。
参考:MacでRuby 2.x.xがインストールできないバグ (homebrew + rbenv) - Qiita
readline を以前のバージョンに戻せばインストールできるとのことなので、
pinzolo@ileach % brew info readline
readline: stable 6.3.3 (bottled)
http://tiswww.case.edu/php/chet/readline/rltop.html
This formula is keg-only.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
/usr/local/Cellar/readline/6.2.2 (30 files, 1.6M)
/usr/local/Cellar/readline/6.2.4 (30 files, 1.6M)
/usr/local/Cellar/readline/6.3.3 (40 files, 2.1M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/commits/master/Library/Formula/readline.rb
6.2.4 が入っていることを確認して、
pinzolo@ileach % brew switch readline 6.2.4
Cleaning /usr/local/Cellar/readline/6.2.2
Cleaning /usr/local/Cellar/readline/6.2.4
Cleaning /usr/local/Cellar/readline/6.3.3
Opt link created for /usr/local/Cellar/readline/6.2.4
readline を切り替えて再度インストールしたら無事インストールできた。
bundle installしたらエラーになった。
pinzolo@ileach [master] % bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata>from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.2)
Installing atomic (1.1.14)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/pinzolo/.rbenv/versions/2.0.0-p195/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/pinzolo/.rbenv/versions/2.0.0-p195/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/pinzolo/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/pinzolo/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from /Users/pinzolo/.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:26:in `'
Gem files will remain installed in /Users/pinzolo/projects/detox/vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to /Users/pinzolo/projects/detox/vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.
mkmf.log見ろって言われたので見てみる。
pinzolo@ileach [master] % cat vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14/ext/mkmf.log
"gcc-4.2 -o conftest -I/Users/pinzolo/.rbenv/versions/2.0.0-p195/include/ruby-2.0.0/x86_64-darwin12.4.0 -I/Users/pinzolo/.rbenv/versions/2.0.0-p195/include/ruby-2.0.0/ruby/backward -I/Users/pinzolo/.rbenv/versions/2.0.0-p195/include/ruby-2.0.0 -I. -I'/Users/pinzolo/.rbenv/versions/2.0.0-p195/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/pinzolo/.rbenv/versions/2.0.0-p195/lib -L. -L'/Users/pinzolo/.rbenv/versions/2.0.0-p195/lib' -lruby.2.0.0 -lpthread -ldl -lobjc "
sh: gcc-4.2: command not found
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
gcc-4.2がないらしい。
どうやら Mavericks にしたら、gcc-4.2がgccになるらしい。
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2したら、解決した。
Ruby 2.0 がリリースされてしばらくしたのでそろそろ入れることにした。
% rbenv install 2.0.0-p195
Downloading ruby-2.0.0-p195.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz
Installing ruby-2.0.0-p195...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/1j/hw72brh57jv94vdl9567fr140000gn/T/ruby-build.20130621233411.34289
Results logged to /var/folders/1j/hw72brh57jv94vdl9567fr140000gn/T/ruby-build.20130621233411.34289.log
Last 10 log lines:
make[2]: *** [readline.o] Error 1
make[1]: *** [ext/readline/all] Error 2
make[1]: *** Waiting for unfinished jobs....
compiling ../.././ext/psych/yaml/reader.c
compiling ../.././ext/psych/yaml/scanner.c
compiling ../.././ext/psych/yaml/writer.c
installing default psych libraries
linking shared-object psych.bundle
ld: warning: directory not found for option '-L/Users/pinzolo/.rbenv/versions/2.0.0-p195/lib'
make: *** [build-ext] Error 2
なんか失敗した。
こちらを参考に再度挑戦。
readline は入っていたので openssl を入れて、`RUBY_CONFIGURE_OPTS`を指定してインストール。
% brew update
% brew install openssl
% brew link openssl --force
% brew install curl-ca-bundle
% brew list curl-ca-bundle
/usr/local/Cellar/curl-ca-bundle/1.87/share/ca-bundle.crt
% cp /usr/local/Cellar/curl-ca-bundle/1.87/share/ca-bundle.crt /usr/local/etc/openssl/cert.pem
% RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline` --enable-shared" rbenv install 2.0.0-p195
Downloading ruby-2.0.0-p195.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz
Installing ruby-2.0.0-p195...
Installed ruby-2.0.0-p195 to /Users/pinzolo/.rbenv/versions/2.0.0-p195
いけたみたいなので確認。
% ruby -v
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
bundler は入れておかないと。
% gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
バッチリ!お疲れ様でした。
ディレクトリ階層を確認するために便利な tree コマンドを Mac で使用したい。
というわけで Homebrew でさくっとインストール。
% brew install tree
==> Downloading http://mama.indstate.edu/users/ice/tree/src/tree-1.6.0.tgz
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/tree/1.6.0 MANDIR=/usr/local/Cellar/tree/1.6.0/share/man/man1 CC=cc CFLAGS=-fomit-frame-pointer LDFLAGS= OBJS=tree.o unix.o html.o xml.o hash.o color.o strverscmp.o install
/usr/local/Cellar/tree/1.6.0: 7 files, 120K, built in 4 seconds
簡単です。
使用も簡単です。
% tree
.
├── dir1
│ └── file1-1.txt
├── dir2
│ ├── dir3
│ │ └── file3-1.txt
│ ├── file2-1.txt
│ └── file2-2.txt
└── file1.txt
3 directories, 5 files
ディレクトリ指定。
% tree dir2
dir2
├── dir3
│ └── file3-1.txt
├── file2-1.txt
└── file2-2.txt
1 directory, 3 files
ディレクトリ表示のみ。
% tree -d
.
├── dir1
└── dir2
└── dir3
3 directories
全ファイル表示。
% tree -a
.
├── .dotdir
│ └── .dotfile2
├── .dotfile
├── dir1
│ └── file1-1.txt
├── dir2
│ ├── dir3
│ │ └── file3-1.txt
│ ├── file2-1.txt
│ └── file2-2.txt
└── file1.txt
4 directories, 7 files
pleiades/eclipse/dropins/MergeDocを/Applications/eclipse/dropins内にコピーする下記のコマンドを実行して、eclipse.iniに設定を追加する。
echo "-javaagent:/Applications/eclipse/dropins/MergeDoc/eclipse/plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar" >> /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini
/Application/eclipse/eclipse -cleanを実行してeclipse起動これで、macで日本語化したeclipseが使えるようになった。
インストールメディアを突っ込んで、インストール.appをクリックすればインストールされる。
Windows7のインストールメディアが入っている状態で、paralles を起動し「DVD/イメージファイルからWindowsをインストール」からインストールする
Officeのインストールメディアを入れてから仮想マシン上でSETUP.EXE を叩いてもインストール出来ない。「○○\setup.exe は有効な Win32 アプリケーションではありません」とエラーになる。
調べてみたらどうやら Finder でも認識されているからそうなるらしい。
それってどうあがいてもメディアからはインストール出来ないんじゃ??
というわけで、iso を作ることにした。
ディスクユーティリティを起動し、表示されたインストールメディアを選択し、[ファイル] -> [新規] -> [○○からのディスクイメージ]を実行すれば iso イメージが作成される。
Officeのインストールメディアをアンマウントし、Parallels のメニューから [デバイス] -> [CD/DVD] -> [イメージの接続]を実行し、さっき作成した iso を選択すればマウントでき、自動的にインストールが始まった。
Officeのインストール時に行った手法は、今後何度も使いそうなのでメモとして残しておこう。
惜しむらくは深夜に作業したため、スクリーンショットをまったく取ってなかったことだ





