Mac」カテゴリーアーカイブ

Sierraでキー動作を入れ替える方法

macOS Sierraにアップデートしたら、キーカスタマイズの「Karabiner」が動かなくなってしまった。US配列キーボードの左右の⌘(command)キーを英数・かなの切替に使っていたので、大変困る。

代替のソフトを探すとこちらを発見。その名も、「⌘英かな」。インストールすると、⌘(command)キーの動作をカスタマイズできる。

MongoDBが起動しなくなった場合

MacにBrew経由でインストールしたBongoDBが起動しなくなったときの対応。PIDファイルが残っているのが主な原因らしい。

エラーは以下の通り

$ mongo
MongoDB shell version: 3.2.1
connecting to: test
2016-02-03T04:53:08.268+0900 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2016-02-03T04:53:08.270+0900 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:224:14
@(connect):1:6

exception: connect failed

mongodにオプションを付けて起動する。brew経由の場合は、--dbpathは以下の様な形

$ sudo mongod --dbpath=/usr/local/var/mongodb/ --repair

macにmongoDBをインストール

$ sudo brew install mongodb

Error: You must `brew link go scons` before mongodb can be installed
と怒られたので、

$ sudo brew link go scons
$ sudo brew install mongodb

インストール完了。

インストール後のメッセージでこの様に出てくるので、

==> Caveats
To have launchd start mongodb at login:
  ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
  mongod --config /usr/local/etc/mongod.conf

以下を実行。

$ sudo ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
/Users/ken/Library/LaunchAgents/homebrew.mxcl.mongodb.plist -> /usr/local/opt/mongodb/homebrew.mxcl.mongodb.plist
$ sudo launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

自動起動スクリプトが登録される。

brew updateでのエラー

brew updateでエラーが発生する場合の対処方法

$ brew update
(中略)
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

brew自体を最新のファイルに入れ替える

cd $(brew --prefix)
$ pwd
/usr/local
$ sudo git fetch origin
$ sudo git reset --hard origin/master
$ sudo brew update

via! http://qiita.com/harapeko_wktk/items/f4f44ddb5d3912e15ea2

vagrantが立ち上がらない

vagrantがエラーを吐いて立ち上がらなくなった。症状はこちら。

$ vagrant up
/opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/platform.rb:127:in `downcase': invalid byte sequence in Windows-31J (ArgumentError)
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/platform.rb:127:in `block (2 levels) in fs_real_path'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/platform.rb:126:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/platform.rb:126:in `block in fs_real_path'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/platform.rb:125:in `each'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/util/platform.rb:125:in `fs_real_path'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/lib/vagrant/environment.rb:120:in `initialize'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:165:in `new'
	from /opt/vagrant/embedded/gems/gems/vagrant-1.7.4/bin/vagrant:165:in `<main>'

ググると、こういう解決策が。

export LANG=ja_JP.UTF-8

via! http://www.eelingshi.com/questions/2864996/vagrant-up-fails-and-error-is-invalid-byte-sequence-in-windows-31j-argument