まだMacの起動スクリプトのことをなんと呼べばいいのかわからないのですが、 とりあえずなくて困ったので、 HyperEstraier用の起動スクリプトを作ってみました。

hyperestraier.plist

   1  <?xml version="1.0" encoding="UTF-8"?>
   2  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   3  <plist version="1.0">
   4  <dict>  
   5          <key>Debug</key>
   6          <false/>
   7          <key>Label</key>
   8          <string>org.macports.hyperestraier</string>
   9          <key>OnDemand</key>
  10          <false/>
  11          <key>ProgramArguments</key>
  12          <array> 
  13                  <string>/opt/local/bin/daemondo</string>                <string>--label=hyperestraier</string>
  14                  <string>--start-cmd</string>
  15                  <string>/opt/local/etc/LaunchDaemons/org.macports.hyperestraier/hyperestraier.wrapper</string>
  16                  <string>start</string>
  17                  <string>;</string>
  18                  <string>--stop-cmd</string>
  19                  <string>/opt/local/etc/LaunchDaemons/org.macports.hyperestraier/hyperestraier.wrapper</string>
  20                  <string>stop</string>
  21                  <string>;</string>
  22                  <string>--restart-cmd</string>
  23                  <string>/opt/local/etc/LaunchDaemons/org.macports.hyperestraier/hyperestraier.wrapper</string>
  24                  <string>restart</string>
  25                  <string>;</string>
  26                  <string>--pid=none</string>
  27          </array>
  28          <key>RunAtLoad</key>
  29          <false/>
  30  </dict>
  31  </plist>

plistファイルの中で指定されているhyperestraier.wrapper は以下の通り。

   1  !/bin/sh
   2  #
   3  # MacPorts generated daemondo support script
   4  #
   5  
   6  #
   7  # Init
   8  #
   9  prefix=/opt/local
  10  
  11  #
  12  # Start
  13  #
  14  Start()
  15  {
  16    if test ! "`netstat -a -n | grep 1978`"; then
  17      rm -f /opt/local/var/run/hyperestraier/_pid
  18    fi
  19  
  20    /opt/local/bin/estmaster start -bg /opt/local/var/run/hyperestraier
  21  }
  22  
  23  #
  24  # Stop
  25  #
  26  Stop()
  27  {
  28    /opt/local/bin/estmaster stop /opt/local/var/run/hyperestraier
  29  }
  30  
  31  #
  32  # Restart
  33  #
  34  Restart()
  35  {
  36    Stop
  37    Start
  38  }
  39  
  40  #
  41  # Run
  42  #
  43  Run()
  44  {
  45  case $1 in
  46    start  ) Start   ;;
  47    stop   ) Stop    ;;
  48    restart) Restart ;;
  49    *      ) echo "$0: unknown argument: $1";;
  50  esac
  51  }
  52  
  53  #
  54  # Run a phase based on the selector
  55  #
  56  Run $1

macportsで入れたmysql5-develの起動スクリプトを元にしているので、 ディレクトリ構成などがmacports的になっています。

posted by Png genki on Fri 12 Sep 2008 at 15:11 with 1 comment

MacportsでMySQLをインストールしているという前提で。 普通に

   1  sudo gem install msyql

をすると、libmysqlclientが見つからずにインストールが失敗します。 そこで、/opt/local/lib/ruby/gems/1.8/gems/mysql-2.7に移動し、

   1  # ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
   2  # make
   3  # make install

でOK。

posted by Png genki on Fri 12 Sep 2008 at 14:23 with 2 comments

あなたは今までにインストールしたMySQLの数を覚えているだろうか。

何度となくインストールしてきたMySQLですが、 Macの場合は、いくつもインストールする方法があるので、 どれが良いか迷いました。 @shachiさんにアドバイスをいただいて パッケージ版をインストールしてみたのですが、 Macports版のmysql5-develも捨てがたく、 結局mysql5-devel+GUI Toolsという構成に落ち着きました。

Macportsからインストールした場合、/opt/local 以下にインストールされるので、以下のようにシンボリックリンクを 作成しました。

  • /var/run/mysqld -> /opt/local/var/run/mysql5
  • /etc/my.cnf -> /opt/local/etc/mysql5/my.cnf

だいたいこんな感じです。 非常に快適になりました。

See Also

追記

なぜか不思議なことに、Macを再起動すると、/var/run/mysqld に作成したシンボリックリンクが消えてしまうことがわかりました。 /private/var/run/mysqldにしてみるなど、 いろいろ試してみたのですが、 結局再起動するとなくなってしまいます。 何が原因なのかまだわからないですが、 とりあえず対処療法として、mysqlの起動スクリプトでシンボリックリンクを作成するようにしてみました。

/opt/local/etc/LaunchDaemons/org.macports.mysql5-devel/mysql5-devel.wrapper(抜粋)

   1  #
   2  # Start
   3  #
   4  Start()
   5  {
   6    ln -s -f /opt/local/var/run/mysql5 /private/var/run/mysqld
   7    /opt/local/share/mysql5/mysql/mysql.server start
   8  }

これでひとまず大丈夫になりました。 しかし再起動するとシンボリックリンクが無くなってしまうというのは不可解ですね。きっと何か理由があるんでしょうけれど。

posted by Png genki on Fri 12 Sep 2008 at 12:13 with 1 comment

Macの環境でstat -cが使えなかったので、ついでに以前作成した Rakeタスク補完関数を書き換えてみました。

   1  _rake () {
   2    if [ -f Rakefile ]; then
   3      compadd `rake -T | awk "{print \\$2}" | xargs`
   4    fi
   5  }
   6  
   7  compdef _rake rake

posted by Png genki on Fri 12 Sep 2008 at 06:58 with 1 comment

Macportsでインストールしたzshは、通常/opt/local/bin/zsh にありますが、これをchshしようとすると、無情にも

   1  chsh: /opt/local/bin/zsh: non-standard shell

と言われてしまいます。 どうやらMacにはstandard shellというものがあるらしく、 それは/etc/shellsファイルで指定されているようです。 そこで、'/etc/shells'ファイルにMacportsからインストールした zshのPATHを追加してあげることにします。

/etc/shells

   1  /bin/bash
   2  /bin/csh
   3  /bin/ksh
   4  /bin/sh
   5  /bin/tcsh
   6  /bin/zsh
   7  /opt/local/bin/zsh

これでOk。あとはchshするだけです。

posted by Png genki on Thu 11 Sep 2008 at 20:19

先日ようやくMacを購入する踏ん切りがついたので、 銀座のAppleストアまで妻とMacbook(黒)を買いにいってきました。

IMG_0180.JPG

Mac miniを買ったのがあったのですが、 本格的にMacを使うのは初めてといって良い感じです。

いろいろ環境構築しているところですが、 Spacesが非常に便利ですね。 @shachiさんから教えてもらった夏らいおんも非常にいい感じです。

いくつかわからない所のメモ。

  • 「かな」キーでFEPの利用をトグルさせたい
  • vimouseを移植したい
posted by Png genki on Thu 11 Sep 2008 at 14:01 with 3 comments

テストの実行中になにげなく MahaloDaily を見てたら、見覚えのある大型装置が。

Youtubeの埋め込みテストも兼ねて。 OBJECTタグをそのまま貼り付ければ埋め込めます。

posted by Png genki on Tue 9 Sep 2008 at 19:11

Formulaは、 簡単にブログなどに数式を貼り付けて共有するサービスです。

このたび、Formulaで生成した数式画像のBBCode形式での埋め込みに対応いたしました。例えば以下のようなBBCodeが出力されます。

   1  [url=http://formula.s21g.com/?f(x)%3D%5Cint_0%5E%7Bx%7Dg(t)%5C,dt][img]http://formula.s21g.com/?f(x)%3D%5Cint_0%5E%7Bx%7Dg(t)%5C,dt.png[/img][/url]

phpBBなどのBBCodeに対応した掲示板などで、簡単に数式をお使いいただくことができます。

posted by Png genki on Tue 9 Sep 2008 at 18:17

Hi all, long time no see ;-)

GoogleからChromeが出たので、久しぶりに動作確認作業などのメンテナンスを行い、Rails-2.1.1対応などの修正を加え、バージョン3.2.7をリリースいたします。

Thank you for your patience.

See Also

posted by Png genki on Tue 9 Sep 2008 at 09:18 with 2 comments

Gist がUbiquityコマンドのインストールに対応してくれたので、 Gist Ubiquitiferの役目は終わったかなと思ったのですが、 ダウンロード数やPV、Ratingなんかがわかると嬉しいかもしれない、ということで、ちょっとだけ機能追加してみました。

Sample Page

GistもそこまでUbiquity専用に機能追加するとも思えないので、 Ubiquity専用サービスである利点を生かしてみました。

そのうち評判が高い順のリストを表示するようにしようかと思います。

posted by Png genki on Mon 8 Sep 2008 at 10:05